Added support for volatile status effects including confusion and flinching. Also, all elements are now supported.

This commit is contained in:
James Daly
2019-06-03 22:46:09 -04:00
parent 34cd67c36f
commit ce81ab2079
12 changed files with 355 additions and 155 deletions

View File

@@ -1,4 +1,5 @@
- name: 'brn'
brn:
name: 'brn'
id: 'brn'
num: 0
effectType: 'Status'
@@ -24,8 +25,54 @@
onResidual: |
mon.takeDamage(mon(Hp) / 16);
println(s"${mon} was hurt by its burn!")
- name: 'par'
confusion:
id: confusion
name: confusion
num: 0
onBeforeMove: |-
self.intData("time") -= 1
if (self.intData("time") <= 0) {
mon -= self
true
} else {
println(s"${mon} is confused!")
if (rng.chance(1, 3)) {
// confusion damage
val maxDmg = (2 * mon.level / 5 + 2) * 40 * mon(PAtk) / (mon(PDef) * 50) + 2
val minDmg = (17 \\ 20) * maxDmg
val dmg = rng.nextInt(minDmg, maxDmg)
println(s"${mon} hurt itself in its confusion.")
mon.takeDamage(dmg)
false
} else {
true
}
}
/*
this.activeTarget = mon;
let damage = this.getDamage(mon, mon, 40);
if (typeof damage !== 'number') throw new Error('Confusion damage not dealt');
mon.takeDamage(damage, mon, mon, /** @type {ActiveMove} */ ({
'id': 'confused',
'effectType': 'Move',
'type': '???'
}));
*/
onBeforeMovePriority: 3
onEnd: println(s"${mon} snapped out of its confusion.")
onStart: |-
println(s"${mon} was confused!")
/*
if (sourceEffect && sourceEffect.id === 'lockedmove') {
this.add('-start', target, 'confusion', '[fatigue]');
} else {
this.add('-start', target, 'confusion');
}*/
self.intData("time") = rng.nextInt(2, 6);
par:
name: 'par'
id: 'par'
num: 0
effectType: 'Status'
@@ -55,7 +102,8 @@
true
}
- name: 'slp'
slp:
name: 'slp'
id: 'slp'
num: 0
effectType: 'Status'
@@ -91,7 +139,21 @@
!move.flags("sleepUsable")
}
- name: 'frz'
flinch:
duration: 1
id: flinch
name: flinch
num: 0
onBeforeMove: |-
println(s"${mon} flinched!")
false
onBeforeMovePriority: 8
onResidualOrder: 13
onResidual: |
mon -= self
frz:
name: 'frz'
effectType: Status
id: frz
num: 0
@@ -127,7 +189,8 @@
mon.cureStatus()
}
- name: 'psn'
psn:
name: 'psn'
id: 'psn'
num: 0
effectType: 'Status'
@@ -147,7 +210,8 @@
mon.takeDamage(mon(Hp) / 8);
println(s"${mon} was damaged by poison!")
- name: 'tox'
tox:
name: 'tox'
id: 'tox'
num: 0
effectType: 'Status'