2021-03-28 18:22:46 +00:00
|
|
|
namespace Gen7 {
|
|
|
|
[Move effect=2_5HitMove]
|
|
|
|
class MultiHitMove : PkmnScript{
|
|
|
|
void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8 &inout numberHits) override {
|
|
|
|
auto randValue = choice.User.Battle.Random.Get(6);
|
|
|
|
switch (randValue){
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
numberHits = 2;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
numberHits = 3;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
numberHits = 4;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
numberHits = 5;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw("Invalid randValue");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-25 19:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if TESTS
|
|
|
|
|
2021-08-28 10:32:23 +00:00
|
|
|
void MultiHitMove_TestHits(uint seed, uint8 expectedHits){
|
2021-08-25 19:18:41 +00:00
|
|
|
auto battle = CreateSimpleBattle(seed, "charizard", "venusaur", 100);
|
|
|
|
auto mon1 = battle.GetBattleSide(0).GetPokemon(0);
|
|
|
|
|
|
|
|
auto choice = CreateMoveTurnChoice("tackle", mon1, 1, 0);
|
|
|
|
auto script = cast<Gen7::MultiHitMove>(CreateMoveScript("2_5HitMove"));
|
|
|
|
uint8 numberHits = 1;
|
|
|
|
script.ModifyNumberOfHits(choice, numberHits);
|
|
|
|
RequireEquals(expectedHits, numberHits);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test name="2-5 Hit Move"]
|
|
|
|
void MultiHitMove_HasMultiHits(){
|
2021-08-28 10:32:23 +00:00
|
|
|
MultiHitMove_TestHits(684, 3);
|
|
|
|
MultiHitMove_TestHits(78216, 4);
|
|
|
|
MultiHitMove_TestHits(123640, 3);
|
|
|
|
MultiHitMove_TestHits(280282, 2);
|
|
|
|
MultiHitMove_TestHits(353353, 3);
|
|
|
|
MultiHitMove_TestHits(388667, 2);
|
|
|
|
MultiHitMove_TestHits(436269, 2);
|
|
|
|
MultiHitMove_TestHits(784419, 5);
|
|
|
|
MultiHitMove_TestHits(800144, 2);
|
|
|
|
MultiHitMove_TestHits(901811, 5);
|
|
|
|
MultiHitMove_TestHits(992841, 4);
|
2021-08-25 19:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|