26 lines
939 B
ActionScript
26 lines
939 B
ActionScript
|
namespace Gen7 {
|
||
|
[Ability effect=BadDreams]
|
||
|
class BadDreams : PkmnScript {
|
||
|
void OnEndTurn(){
|
||
|
auto owner = cast<Pokemon@>(GetOwner());
|
||
|
auto ownerSide = owner.BattleSide;
|
||
|
auto battle = owner.Battle;
|
||
|
if (battle is null) return;
|
||
|
for (uint64 i = 0; i < battle.Sides.Length; i++){
|
||
|
auto side = battle.Sides[i];
|
||
|
if (side is ownerSide){
|
||
|
continue;
|
||
|
}
|
||
|
for (uint64 j = 0; j < side.Pokemon.Length; j++){
|
||
|
auto opponent = side.Pokemon[j];
|
||
|
if (opponent is null || opponent.IsFainted){
|
||
|
continue;
|
||
|
}
|
||
|
if (opponent.Status == "Sleep"){
|
||
|
opponent.Damage(uint(opponent.MaxHealth / 8), DamageSource::Misc);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|