Thanks !
I don't know why it corrupts the file but what I know is that I have troubles with fonctions which have self.var or save.var. Here's an example with the Fastitocalon fake. Its AI:
if (rand() % 3 == 0) {
    return
}
if (self.status == CONFUSION) {
    target(207)
    if (self.varDC == 0) {
        target(200)
        domoveid(2)
        self.varDC = 1
        changeresistance(3, 900)
        changestat(1, 10)
        changestat(3, 10)
    }
    else {
        target(207)
        domoveid(1)
    }
    return
}
if (self.varDC == 0) {
    target(201)
    domoveid(0)
}
else {
    target(201)
    domoveid(1)
}
When I try to change a simple number, I can compile it, save and when I go back to the file, the AI has changed to something bugged:
if (rand() % 3 == 0) {
    return
}
if (self.status == CHARGED) {
    target(207)
    if (self.hp == 20) {
        domoveid(2)
        self.varDC = 1
        changeresistance(3, 900)
        changestat(1, 10)
        changestat(3, 10)
    }
    else {
        target(204)
        domoveid(1)
    }
    return
}
if (self.hp == 7) {
    domoveid(0)
}
else {
    target(201)
    domoveid(1)
}