2020-04-10 22:23:17 +00:00
|
|
|
namespace Gen7 {
|
|
|
|
[Move effect=Acrobatics]
|
|
|
|
class Acrobatics : PkmnScript{
|
|
|
|
void OverrideBasePower(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& basePower) override {
|
|
|
|
if (attack.User.HeldItem is null){
|
|
|
|
if (basePower >= 128) basePower = 255;
|
|
|
|
else basePower *= 2;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2021-08-25 19:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if TESTS
|
|
|
|
[Test name="Acrobatics: Base Power without item"]
|
|
|
|
void Acrobatics_BasePowerWithoutItem(){
|
|
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto mon2 = battle.GetBattleSide(1).GetPokemon(0);
|
|
|
|
|
|
|
|
auto script = cast<Gen7::Acrobatics>(CreateMoveScript("Acrobatics"));
|
|
|
|
Require(script !is null);
|
|
|
|
uint8 bp = 20;
|
|
|
|
auto executingMove = CreateExecutingMove("Acrobatics", mon1, mon2);
|
|
|
|
script.OverrideBasePower(executingMove, mon2, 0x0, bp);
|
|
|
|
RequireEquals(40, bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test name="Acrobatics: Base Power with item"]
|
|
|
|
void Acrobatics_BasePowerWithItem(){
|
|
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto mon2 = battle.GetBattleSide(1).GetPokemon(0);
|
|
|
|
mon1.SetHeldItem("poke_ball");
|
|
|
|
|
|
|
|
auto script = cast<Gen7::Acrobatics>(CreateMoveScript("Acrobatics"));
|
|
|
|
Require(script !is null);
|
|
|
|
uint8 bp = 20;
|
|
|
|
auto executingMove = CreateExecutingMove("Acrobatics", mon1, mon2);
|
|
|
|
script.OverrideBasePower(executingMove, mon2, 0x0, bp);
|
|
|
|
RequireEquals(20, bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test name="Acrobatics: Base Power without item with base power > 128"]
|
|
|
|
void Acrobatics_BasePowerWithoutItemWithHighBasePower(){
|
|
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto mon2 = battle.GetBattleSide(1).GetPokemon(0);
|
|
|
|
|
|
|
|
auto script = cast<Gen7::Acrobatics>(CreateMoveScript("Acrobatics"));
|
|
|
|
Require(script !is null);
|
|
|
|
uint8 bp = 140;
|
|
|
|
auto executingMove = CreateExecutingMove("Acrobatics", mon1, mon2);
|
|
|
|
script.OverrideBasePower(executingMove, mon2, 0x0, bp);
|
|
|
|
RequireEquals(255, bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test name="Acrobatics: Damage without item"]
|
|
|
|
void Acrobatics_TestDamageWithoutItem(){
|
|
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto mon2 = battle.GetBattleSide(1).GetPokemon(0);
|
|
|
|
auto startHealth = mon2.CurrentHealth;
|
|
|
|
Require(mon1.UseMove("acrobatics", 1, 0));
|
|
|
|
Require(mon2.PassTurn());
|
|
|
|
RequireEquals(272, startHealth - mon2.CurrentHealth);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test name="Acrobatics: Damage with item"]
|
|
|
|
void Acrobatics_TestDamageWithItem(){
|
|
|
|
auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
auto mon2 = battle.GetBattleSide(1).GetPokemon(0);
|
|
|
|
mon1.SetHeldItem("poke_ball");
|
|
|
|
|
|
|
|
auto startHealth = mon2.CurrentHealth;
|
|
|
|
Require(mon1.UseMove("acrobatics", 1, 0));
|
|
|
|
Require(mon2.PassTurn());
|
|
|
|
RequireEquals(139, startHealth - mon2.CurrentHealth);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|