Change freeze dry to allow easier extendebility (#4312)
* Change freeze dry to allow easier extensibility * give body press the foul play treatment * Tests
This commit is contained in:
parent
5a986c6d04
commit
92e23415ab
@ -222,7 +222,7 @@ enum {
|
||||
EFFECT_HEAL_PULSE,
|
||||
EFFECT_QUASH,
|
||||
EFFECT_ION_DELUGE,
|
||||
EFFECT_FREEZE_DRY,
|
||||
EFFECT_SUPER_EFFECTIVE_ON_ARG,
|
||||
EFFECT_TOPSY_TURVY,
|
||||
EFFECT_MISTY_TERRAIN,
|
||||
EFFECT_GRASSY_TERRAIN,
|
||||
|
||||
@ -4258,7 +4258,7 @@ static u32 AI_CalcMoveScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case EFFECT_SOAK:
|
||||
if (HasMoveWithType(battlerAtk, TYPE_ELECTRIC) || HasMoveWithType(battlerAtk, TYPE_GRASS) || HasMoveEffect(battlerAtk, EFFECT_FREEZE_DRY))
|
||||
if (HasMoveWithType(battlerAtk, TYPE_ELECTRIC) || HasMoveWithType(battlerAtk, TYPE_GRASS) || (HasMoveEffect(battlerAtk, EFFECT_SUPER_EFFECTIVE_ON_ARG) && gMovesInfo[move].argument == TYPE_WATER) )
|
||||
ADJUST_SCORE(DECENT_EFFECT); // Get some super effective moves
|
||||
break;
|
||||
case EFFECT_THIRD_TYPE:
|
||||
|
||||
@ -9132,8 +9132,16 @@ static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 m
|
||||
}
|
||||
else if (gMovesInfo[move].effect == EFFECT_BODY_PRESS)
|
||||
{
|
||||
atkStat = gBattleMons[battlerAtk].defense;
|
||||
atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF];
|
||||
if (IS_MOVE_PHYSICAL(move))
|
||||
{
|
||||
atkStat = gBattleMons[battlerAtk].defense;
|
||||
atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF];
|
||||
}
|
||||
else
|
||||
{
|
||||
atkStat = gBattleMons[battlerAtk].spDefense;
|
||||
atkStage = gBattleMons[battlerAtk].statStages[STAT_SPDEF];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -9879,7 +9887,7 @@ static inline void MulByTypeEffectiveness(uq4_12_t *modifier, u32 move, u32 move
|
||||
|
||||
if (moveType == TYPE_PSYCHIC && defType == TYPE_DARK && gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED && mod == UQ_4_12(0.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
if (gMovesInfo[move].effect == EFFECT_FREEZE_DRY && defType == TYPE_WATER)
|
||||
if (gMovesInfo[move].effect == EFFECT_SUPER_EFFECTIVE_ON_ARG && defType == gMovesInfo[move].argument)
|
||||
mod = UQ_4_12(2.0);
|
||||
if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef) && mod == UQ_4_12(0.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
|
||||
@ -1429,7 +1429,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
},
|
||||
|
||||
[EFFECT_FREEZE_DRY] =
|
||||
[EFFECT_SUPER_EFFECTIVE_ON_ARG] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
|
||||
@ -13680,7 +13680,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] =
|
||||
.description = COMPOUND_STRING(
|
||||
"Super effective on Water-\n"
|
||||
"types. May cause freezing."),
|
||||
.effect = EFFECT_FREEZE_DRY,
|
||||
.effect = EFFECT_SUPER_EFFECTIVE_ON_ARG,
|
||||
.power = 70,
|
||||
.type = TYPE_ICE,
|
||||
.accuracy = 100,
|
||||
@ -13688,6 +13688,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] =
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.category = DAMAGE_CATEGORY_SPECIAL,
|
||||
.argument = TYPE_WATER,
|
||||
.additionalEffects = ADDITIONAL_EFFECTS({
|
||||
.moveEffect = MOVE_EFFECT_FREEZE_OR_FROSTBITE,
|
||||
.chance = 10,
|
||||
|
||||
29
test/battle/move_effect/body_press.c
Normal file
29
test/battle/move_effect/body_press.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gMovesInfo[MOVE_BODY_PRESS].effect == EFFECT_BODY_PRESS);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Body Press uses physical defense stat of target", s16 damage)
|
||||
{
|
||||
u32 move;
|
||||
|
||||
PARAMETRIZE { move = MOVE_DRILL_PECK; }
|
||||
PARAMETRIZE { move = MOVE_BODY_PRESS; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(gMovesInfo[MOVE_DRILL_PECK].power == gMovesInfo[MOVE_BODY_PRESS].power);
|
||||
ASSUME(gMovesInfo[MOVE_CHARM].effect == EFFECT_ATTACK_DOWN_2);
|
||||
PLAYER(SPECIES_MEW);
|
||||
OPPONENT(SPECIES_SHELLDER);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_CHARM); MOVE(player, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||
} FINALLY {
|
||||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage);
|
||||
}
|
||||
}
|
||||
29
test/battle/move_effect/foul_play.c
Normal file
29
test/battle/move_effect/foul_play.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gMovesInfo[MOVE_FOUL_PLAY].effect == EFFECT_FOUL_PLAY);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Foul Play uses physical attack stat of target", s16 damage)
|
||||
{
|
||||
u32 move;
|
||||
|
||||
PARAMETRIZE { move = MOVE_HIGH_HORSEPOWER; }
|
||||
PARAMETRIZE { move = MOVE_FOUL_PLAY; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(gMovesInfo[MOVE_HIGH_HORSEPOWER].power == gMovesInfo[MOVE_FOUL_PLAY].power);
|
||||
ASSUME(gMovesInfo[MOVE_SWORDS_DANCE].effect == EFFECT_ATTACK_UP_2);
|
||||
PLAYER(SPECIES_SHELLDER);
|
||||
OPPONENT(SPECIES_SHELLDER);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SWORDS_DANCE); MOVE(player, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||
} FINALLY {
|
||||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage);
|
||||
}
|
||||
}
|
||||
21
test/battle/move_effect/super_effective_on_arg.c
Normal file
21
test/battle/move_effect/super_effective_on_arg.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gMovesInfo[MOVE_FREEZE_DRY].effect == EFFECT_SUPER_EFFECTIVE_ON_ARG);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Freeze Dry is super effective on water types")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_SHELLDER);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_FREEZE_DRY); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FREEZE_DRY, player);
|
||||
HP_BAR(opponent);
|
||||
MESSAGE("It's super effective!");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user