Rototiller and 2 turn moves

This commit is contained in:
DizzyEggg 2018-09-30 14:04:46 +02:00
parent 162c83fcff
commit de9e9072fc
9 changed files with 123 additions and 49 deletions

View file

@ -1544,6 +1544,15 @@
.macro powertrick battler
various \battler, VARIOUS_POWER_TRICK
.endm
.macro argumenttomoveeffect
various BS_ATTACKER, VARIOUS_ARGUMENT_TO_MOVE_EFFECT
.endm
.macro jumpifnotgrounded battler, ptr
various \battler, VARIOUS_JUMP_IF_NOT_GROUNDED
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat, stages, down

View file

@ -121,7 +121,6 @@ AI_CheckBadMove_CheckEffect: @ 82DC045
if_effect EFFECT_TOXIC, AI_CBM_Toxic
if_effect EFFECT_LIGHT_SCREEN, AI_CBM_LightScreen
if_effect EFFECT_OHKO, AI_CBM_OneHitKO
if_effect EFFECT_RAZOR_WIND, AI_CBM_HighRiskForDamage
if_effect EFFECT_SUPER_FANG, AI_CBM_HighRiskForDamage
if_effect EFFECT_MIST, AI_CBM_Mist
if_effect EFFECT_FOCUS_ENERGY, AI_CBM_FocusEnergy
@ -834,7 +833,6 @@ AI_CheckViability:
if_effect EFFECT_LIGHT_SCREEN, AI_CV_LightScreen
if_effect EFFECT_REST, AI_CV_Rest
if_effect EFFECT_OHKO, AI_CV_OneHitKO
if_effect EFFECT_RAZOR_WIND, AI_CV_ChargeUpMove
if_effect EFFECT_SUPER_FANG, AI_CV_SuperFang
if_effect EFFECT_TRAP, AI_CV_Trap
if_effect EFFECT_CONFUSE, AI_CV_Confuse
@ -857,7 +855,7 @@ AI_CheckViability:
if_effect EFFECT_PARALYZE, AI_CV_Paralyze
if_effect EFFECT_SWAGGER, AI_CV_Swagger
if_effect EFFECT_SPEED_DOWN_HIT, AI_CV_SpeedDownFromChance
if_effect EFFECT_SKY_ATTACK, AI_CV_ChargeUpMove
if_effect EFFECT_TWO_TURNS_ATTACK, AI_CV_ChargeUpMove
if_effect EFFECT_VITAL_THROW, AI_CV_VitalThrow
if_effect EFFECT_SUBSTITUTE, AI_CV_Substitute
if_effect EFFECT_RECHARGE, AI_CV_Recharge

View file

@ -53,7 +53,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectTriAttack
.4byte BattleScript_EffectRest
.4byte BattleScript_EffectOHKO
.4byte BattleScript_EffectRazorWind
.4byte BattleScript_EffectFusionCombo
.4byte BattleScript_EffectSuperFang
.4byte BattleScript_EffectDragonRage
.4byte BattleScript_EffectTrap
@ -89,7 +89,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectSpecialDefenseDownHit
.4byte BattleScript_EffectAccuracyDownHit
.4byte BattleScript_EffectEvasionDownHit
.4byte BattleScript_EffectSkyAttack
.4byte BattleScript_EffectTwoTurnsAttack
.4byte BattleScript_EffectConfuseHit
.4byte BattleScript_EffectTwineedle
.4byte BattleScript_EffectVitalThrow
@ -326,6 +326,50 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectFlameBurst
.4byte BattleScript_EffectAfterYou
.4byte BattleScript_EffectBestow
.4byte BattleScript_EffectRototiller
BattleScript_EffectRototiller:
attackcanceler
attackstring
ppreduce
selectfirstvalidtarget
BattleScript_RototillerLoop:
movevaluescleanup
jumpifnotgrounded BS_TARGET, BattleScript_RototillerNoEffect
jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_RototillerLoop2
BattleScript_RototillerNoEffect:
pause 0x20
printstring STRINGID_NOEFFECTONTARGET
waitmessage 0x40
goto BattleScript_RototillerMoveTargetEnd
BattleScript_RototillerLoop2:
jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_RototillerDoMoveAnim
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, 0xC, BattleScript_RototillerCantRaiseMultipleStats
BattleScript_RototillerDoMoveAnim::
attackanimation
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, 0x0
setstatchanger STAT_ATK, 1, FALSE
statbuffchange 0x1, BattleScript_RototillerTrySpAtk
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_RototillerTrySpAtk
printfromtable gStatUpStringIds
waitmessage 0x40
BattleScript_RototillerTrySpAtk::
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange 0x1, BattleScript_RototillerMoveTargetEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_RototillerMoveTargetEnd
printfromtable gStatUpStringIds
waitmessage 0x40
BattleScript_RototillerMoveTargetEnd:
setbyte sMOVEEND_STATE, 0x0
moveend 0x2, 0x10
jumpifnexttargetvalid BattleScript_RototillerLoop
end
BattleScript_RototillerCantRaiseMultipleStats:
printstring STRINGID_STATSWONTINCREASE2
waitmessage 0x40
goto BattleScript_RototillerMoveTargetEnd
BattleScript_EffectBestow:
attackcanceler
@ -1431,8 +1475,10 @@ BattleScript_HitEscapeEnd:
end
BattleScript_EffectPlaceholder:
showabilitypopup BS_TARGET
attackcanceler
attackstring
ppreduce
pause 0x5
printstring STRINGID_NOTDONEYET
goto BattleScript_MoveEnd
@ -1480,6 +1526,7 @@ BattleScript_EffectFreezeDry:
BattleScript_EffectTwoTypedMove:
BattleScript_EffectTechnoBlast:
BattleScript_EffectJudgment:
BattleScript_EffectFusionCombo:
jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler
jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler
orword gHitMarker, HITMARKER_IGNORE_UNDERWATER
@ -2070,21 +2117,13 @@ BattleScript_KOFail::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectRazorWind::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
setbyte sTWOTURN_STRINGID, 0x0
call BattleScriptFirstChargingTurn
goto BattleScript_MoveEnd
BattleScript_TwoTurnMovesSecondTurn::
attackcanceler
setmoveeffect MOVE_EFFECT_CHARGING
setbyte sB_ANIM_TURN, 0x1
clearstatusfromeffect BS_ATTACKER
orword gHitMarker, HITMARKER_NO_PPDEDUCT
jumpifnotmove MOVE_SKY_ATTACK, BattleScript_HitFromAccCheck
setmoveeffect MOVE_EFFECT_FLINCH
argumenttomoveeffect
goto BattleScript_HitFromAccCheck
BattleScriptFirstChargingTurn::
@ -2385,12 +2424,29 @@ BattleScript_EffectAccuracyDownHit::
setmoveeffect MOVE_EFFECT_ACC_MINUS_1
goto BattleScript_EffectHit
BattleScript_EffectSkyAttack::
BattleScript_EffectTwoTurnsAttack::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
setbyte sTWOTURN_STRINGID, 0x3
jumpifmove MOVE_SKY_ATTACK, BattleScript_EffectTwoTurnsAttackSkyAttack
jumpifmove MOVE_RAZOR_WIND, BattleScript_EffectTwoTurnsAttackRazorWind
jumpifmove MOVE_ICE_BURN, BattleScript_EffectTwoTurnsAttackIceBurn
jumpifmove MOVE_FREEZE_SHOCK, BattleScript_EffectTwoTurnsAttackFreezeShock
setbyte sTWOTURN_STRINGID, 0x0
BattleScript_EffectTwoTurnsAttackContinue:
call BattleScriptFirstChargingTurn
goto BattleScript_MoveEnd
BattleScript_EffectTwoTurnsAttackSkyAttack:
setbyte sTWOTURN_STRINGID, 0x3
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackRazorWind:
setbyte sTWOTURN_STRINGID, 0x0
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackIceBurn:
setbyte sTWOTURN_STRINGID, 0x0
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackFreezeShock:
setbyte sTWOTURN_STRINGID, 0x0
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectConfuseHit::
setmoveeffect MOVE_EFFECT_CONFUSION

View file

@ -40,7 +40,7 @@
#define EFFECT_TRI_ATTACK 36
#define EFFECT_REST 37
#define EFFECT_OHKO 38
#define EFFECT_RAZOR_WIND 39
#define EFFECT_FUSION_COMBO 39
#define EFFECT_SUPER_FANG 40
#define EFFECT_DRAGON_RAGE 41
#define EFFECT_TRAP 42
@ -76,7 +76,7 @@
#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT 72
#define EFFECT_ACCURACY_DOWN_HIT 73
#define EFFECT_EVASION_DOWN_HIT 74
#define EFFECT_SKY_ATTACK 75
#define EFFECT_TWO_TURNS_ATTACK 75
#define EFFECT_CONFUSE_HIT 76
#define EFFECT_TWINEEDLE 77
#define EFFECT_VITAL_THROW 78
@ -315,5 +315,6 @@
#define EFFECT_FLAME_BURST 309
#define EFFECT_AFTER_YOU 310
#define EFFECT_BESTOW 311
#define EFFECT_ROTOTILLER 312
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View file

@ -117,6 +117,8 @@
#define VARIOUS_POWER_TRICK 63
#define VARIOUS_AFTER_YOU 64
#define VARIOUS_BESTOW 65
#define VARIOUS_ARGUMENT_TO_MOVE_EFFECT 66
#define VARIOUS_JUMP_IF_NOT_GROUNDED 67
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View file

@ -17,6 +17,7 @@
#define CHAR_PERIOD 0xAD
#define CHAR_HYPHEN 0xAE
#define CHAR_ELLIPSIS 0xB0
#define CHAR_APOS 0xB4
#define CHAR_MALE 0xB5
#define CHAR_FEMALE 0xB6
#define CHAR_CURRENCY 0xB7

View file

@ -7035,6 +7035,15 @@ static void atk76_various(void)
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_ARGUMENT_TO_MOVE_EFFECT:
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleMoves[gCurrentMove].argument;
break;
case VARIOUS_JUMP_IF_NOT_GROUNDED:
if (!IsBattlerGrounded(gActiveBattler))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
return;
}
gBattlescriptCurrInstr += 3;
@ -7127,30 +7136,23 @@ static void atk7A_jumpifnexttargetvalid(void)
{
const u8 *jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
for (gBattlerTarget++; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{
for (gBattlerTarget++; ; gBattlerTarget++)
{
if (gBattlerTarget == gBattlerAttacker)
continue;
if (!(gAbsentBattlerFlags & gBitTable[gBattlerTarget]))
break;
}
if (gBattlerTarget == gBattlerAttacker && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_USER))
continue;
if (!(gAbsentBattlerFlags & gBitTable[gBattlerTarget]))
break;
}
if (gBattlerTarget >= gBattlersCount)
gBattlescriptCurrInstr += 5;
else
gBattlescriptCurrInstr = jumpPtr;
}
else
{
if (gBattlerTarget >= gBattlersCount)
gBattlescriptCurrInstr += 5;
}
else
gBattlescriptCurrInstr = jumpPtr;
}
static void atk7B_tryhealhalfhealth(void)
{
const u8* failPtr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
const u8 *failPtr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
if (gBattlescriptCurrInstr[5] == BS_ATTACKER)
gBattlerTarget = gBattlerAttacker;
@ -8718,8 +8720,7 @@ static void atkA8_copymovepermanently(void) // sketch
static bool8 IsTwoTurnsMove(u16 move)
{
if (gBattleMoves[move].effect == EFFECT_SKULL_BASH
|| gBattleMoves[move].effect == EFFECT_RAZOR_WIND
|| gBattleMoves[move].effect == EFFECT_SKY_ATTACK
|| gBattleMoves[move].effect == EFFECT_TWO_TURNS_ATTACK
|| gBattleMoves[move].effect == EFFECT_SOLARBEAM
|| gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE
|| gBattleMoves[move].effect == EFFECT_BIDE)
@ -8745,8 +8746,7 @@ static u8 AttacksThisTurn(u8 battlerId, u16 move) // Note: returns 1 if it's a c
return 2;
if (gBattleMoves[move].effect == EFFECT_SKULL_BASH
|| gBattleMoves[move].effect == EFFECT_RAZOR_WIND
|| gBattleMoves[move].effect == EFFECT_SKY_ATTACK
|| gBattleMoves[move].effect == EFFECT_TWO_TURNS_ATTACK
|| gBattleMoves[move].effect == EFFECT_SOLARBEAM
|| gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE
|| gBattleMoves[move].effect == EFFECT_BIDE)
@ -9431,7 +9431,7 @@ static void atkC2_selectfirstvalidtarget(void)
{
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{
if (gBattlerTarget == gBattlerAttacker)
if (gBattlerTarget == gBattlerAttacker && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_USER))
continue;
if (!(gAbsentBattlerFlags & gBitTable[gBattlerTarget]))
break;

View file

@ -4750,6 +4750,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
if (gChosenMoveByBattler[BATTLE_PARTNER(battlerAtk)] == MOVE_ROUND && !(gAbsentBattlerFlags & gBitTable[BATTLE_PARTNER(battlerAtk)]))
basePower *= 2;
break;
case EFFECT_FUSION_COMBO:
if (gBattleMoves[gLastUsedMove].effect == EFFECT_FUSION_COMBO && move != gLastUsedMove)
basePower *= 2;
break;
}
if (basePower == 0)

View file

@ -160,7 +160,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_RAZOR_WIND
.effect = EFFECT_RAZOR_WIND,
.effect = EFFECT_TWO_TURNS_ATTACK,
.power = 80,
.type = TYPE_NORMAL,
.accuracy = 100,
@ -1720,7 +1720,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_STATUS,
},
{ // MOVE_SKY_ATTACK
.effect = EFFECT_SKY_ATTACK,
.effect = EFFECT_TWO_TURNS_ATTACK,
.power = 140,
.type = TYPE_FLYING,
.accuracy = 90,
@ -1730,6 +1730,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
.split = SPLIT_PHYSICAL,
.argument = MOVE_EFFECT_FLINCH,
},
{ // MOVE_TRANSFORM
.effect = EFFECT_TRANSFORM,
@ -6645,7 +6646,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_SPECIAL,
},
{ // MOVE_FREEZE_SHOCK
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_TWO_TURNS_ATTACK,
.power = 140,
.type = TYPE_ICE,
.accuracy = 90,
@ -6655,9 +6656,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED,
.split = SPLIT_PHYSICAL,
.argument = MOVE_EFFECT_PARALYSIS,
},
{ // MOVE_ICE_BURN
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_TWO_TURNS_ATTACK,
.power = 140,
.type = TYPE_ICE,
.accuracy = 90,
@ -6667,6 +6669,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED,
.split = SPLIT_SPECIAL,
.argument = MOVE_EFFECT_BURN,
},
{ // MOVE_SNARL
.effect = EFFECT_SPECIAL_ATTACK_DOWN_HIT,
@ -6705,7 +6708,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_FUSION_FLARE
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_FUSION_COMBO,
.power = 100,
.type = TYPE_FIRE,
.accuracy = 100,
@ -6717,7 +6720,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_SPECIAL,
},
{ // MOVE_FUSION_BOLT
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_FUSION_COMBO,
.power = 100,
.type = TYPE_ELECTRIC,
.accuracy = 100,
@ -6766,13 +6769,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_SPECIAL,
},
{ // MOVE_ROTOTILLER
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_ROTOTILLER,
.power = 0,
.type = TYPE_GROUND,
.accuracy = 0,
.pp = 10,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED,
.target = MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_USER,
.priority = 0,
.flags = 0,
.split = SPLIT_STATUS,