Added the ability for statuses to have data (like duration) and the sleep and toxic status effects

This commit is contained in:
James Daly
2019-06-02 22:46:32 -04:00
parent 40553d36b9
commit 34cd67c36f
7 changed files with 127 additions and 56 deletions

View File

@@ -60,6 +60,8 @@
num: 0
effectType: 'Status'
onStart: |
println(s"${mon} fell asleep!")
/*
if (sourceEffect && sourceEffect.effectType === 'Ability') {
this.add('-status', target, 'slp', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
} else if (sourceEffect && sourceEffect.effectType === 'Move') {
@@ -67,30 +69,27 @@
} else {
this.add('-status', target, 'slp');
}
*/
// 1-3 turns
this.effectData.startTime = this.random(2, 5);
this.effectData.time = this.effectData.startTime;
self.intData("startTime") = rng.nextInt(2, 5)
self.intData("time") = self.intData("startTime")
onEnd: |
println(s"${mon} woke up!")
onBeforeMovePriority: 10
onBeforeMove: |
/*
if (pokemon.hasAbility('earlybird')) {
pokemon.statusData.time--;
if (mon.hasAbility('earlybird')) {
this.intData.time--;
}
*/
pokemon.statusData.time--;
if (pokemon.statusData.time <= 0) {
pokemon.cureStatus();
return;
self.intData("time") -= 1;
if (self.intData("time") <= 0) {
mon.cureStatus();
true
} else {
println(s"${mon} is fast asleep.")
!move.flags("sleepUsable")
}
/*
this.add('cant', pokemon, 'slp');
if (move.sleepUsable) {
return;
}
*/
return false;
- name: 'frz'
effectType: Status
@@ -153,19 +152,22 @@
num: 0
effectType: 'Status'
onStart: |
this.effectData.stage = 0;
println(s"${mon} was baddly poisoned!")
self.intData("stage") = 0;
/*
if (sourceEffect && sourceEffect.id === 'toxicorb') {
this.add('-status', target, 'tox', '[from] item: Toxic Orb');
} else if (sourceEffect && sourceEffect.effectType === 'Ability') {
this.add('-status', target, 'tox', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
} else {
this.add('-status', target, 'tox');
}
}*/
onSwitchIn: |
this.effectData.stage = 0;
onResidualOrder: 9
onResidual: |
if (this.effectData.stage < 15) {
this.effectData.stage++;
if (self.intData("stage") < 15) {
self.intData("stage") += 1
}
this.damage(this.clampIntRange(pokemon.maxhp / 16, 1) * this.effectData.stage);
mon.takeDamage(self.intData("stage") \\ 16 * mon(Hp));
println(s"${mon} was damaged by poison!")