Gen7Data/Scripts/Moves/ChangeTargetSpeed.as

35 lines
1.1 KiB
ActionScript
Raw Normal View History

2020-04-10 22:23:17 +00:00
namespace Gen7 {
[Move effect=ChangeTargetSpeed]
shared class ChangeTargetSpeed : PkmnScript{
int8 _amount;
2021-10-23 12:20:18 +00:00
void OnInitialize(const narray<EffectParameter@>@ parameters) override{
2020-04-10 22:23:17 +00:00
_amount = int8(parameters[0].AsInt());
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
target.ChangeStatBoost(Statistic::Speed, _amount);
}
}
2021-08-26 17:25:38 +00:00
}
#if TESTS
void TestChangeTargetSpeed(int8 amount){
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
auto script = cast<Gen7::ChangeTargetSpeed>(CreateMoveScript("ChangeTargetSpeed"));
auto executingMove = CreateExecutingMove("Tackle", mon1, mon1);
script._amount = amount;
script.OnSecondaryEffect(executingMove, mon1, 0x0);
RequireEquals(amount, mon1.GetStatBoost(Statistic::Speed));
}
[Test name="ChangeTargetSpeed: Does as the name suggests"]
void ChangeTargetSpeed_Test(){
for (int8 i = -6; i <= 6; i++){
TestChangeTargetSpeed(i);
}
}
#endif