35 lines
1.1 KiB
ActionScript
35 lines
1.1 KiB
ActionScript
namespace Gen7 {
|
|
[Move effect=ChangeTargetAtt]
|
|
class ChangeTargetAttack : PkmnScript{
|
|
int8 _amount;
|
|
|
|
void OnInitialize(const EffectParameter@[] &in parameters) override{
|
|
_amount = int8(parameters[0].AsInt());
|
|
}
|
|
|
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
|
|
target.ChangeStatBoost(Statistic::Attack, _amount);
|
|
}
|
|
}
|
|
}
|
|
|
|
#if TESTS
|
|
void TestChangeAttackStat(int8 amount){
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto script = cast<Gen7::ChangeTargetAttack>(CreateMoveScript("ChangeTargetAtt"));
|
|
auto executingMove = CreateExecutingMove("Tackle", mon1, mon1);
|
|
script._amount = amount;
|
|
script.OnSecondaryEffect(executingMove, mon1, 0x0);
|
|
RequireEquals(amount, mon1.GetStatBoost(Statistic::Attack));
|
|
}
|
|
|
|
[Test name="ChangeTargetAttack: Does as the name suggests"]
|
|
void ChangeTargetAttack_Test(){
|
|
for (int8 i = -6; i <= 6; i++){
|
|
TestChangeAttackStat(i);
|
|
}
|
|
}
|
|
|
|
#endif |