35 lines
1.1 KiB
ActionScript
35 lines
1.1 KiB
ActionScript
|
namespace Gen7 {
|
||
|
[Side effect=AuroraVeil]
|
||
|
class AuroraVeilEffect : PkmnScript {
|
||
|
uint8 _turnsRemaining;
|
||
|
|
||
|
void SetTurns(uint8 turns){
|
||
|
_turnsRemaining = turns;
|
||
|
};
|
||
|
|
||
|
void OverrideIncomingDamage(ExecutingMove@ move, Pokemon@ target, uint8 hit, uint &inout damage) override {
|
||
|
if (move.GetHitData(target, hit).IsCritical){
|
||
|
return;
|
||
|
}
|
||
|
auto side = cast<BattleSide@>(GetOwner());
|
||
|
if (side.HasVolatile("Reflect") && move.UseMove.Category == MoveCategory::Physical){
|
||
|
return;
|
||
|
}
|
||
|
if (side.HasVolatile("LightScreen") && move.UseMove.Category == MoveCategory::Special){
|
||
|
return;
|
||
|
}
|
||
|
auto modifier = 2.0f;
|
||
|
if (target.Battle.PokemonPerSide > 1){
|
||
|
modifier = 1.5f;
|
||
|
}
|
||
|
damage = uint(damage / modifier);
|
||
|
};
|
||
|
|
||
|
void OnEndTurn() override {
|
||
|
auto side = cast<BattleSide@>(GetOwner());
|
||
|
if (_turnsRemaining == 0 || --_turnsRemaining == 0){
|
||
|
side.RemoveVolatile("AuroraVeil");
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|