Merge branch 'battle_engine_v2' into beta

This commit is contained in:
Papa Cancer 2019-04-20 16:49:57 +01:00 committed by GitHub
commit c4acc3dbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 80 additions and 18 deletions

View File

@ -347,10 +347,20 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectVCreate
.4byte BattleScript_EffectMatBlock
.4byte BattleScript_EffectStompingTantrum
.4byte BattleScript_EffectPlaceholder
.4byte BattleScript_EffectPlaceholder
.4byte BattleScript_EffectCoreEnforcer
.4byte BattleScript_EffectThroatChop
BattleScript_EffectCoreEnforcer:
setmoveeffect MOVE_EFFECT_CORE_ENFORCER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_MoveEffectCoreEnforcer::
setgastroacid BattleScript_CoreEnforcerRet
printstring STRINGID_PKMNSABILITYSUPPRESSED
waitmessage 0x40
BattleScript_CoreEnforcerRet:
return
BattleScript_EffectVCreate:
setmoveeffect MOVE_EFFECT_V_CREATE | MOVE_EFFECT_AFFECTS_USER
goto BattleScript_EffectHit
@ -6442,6 +6452,7 @@ BattleScript_RoughSkinActivates::
BattleScript_SpikyShieldEffect::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
printstring STRINGID_PKMNHURTSWITH
@ -6449,6 +6460,23 @@ BattleScript_SpikyShieldEffect::
tryfaintmon BS_ATTACKER, FALSE, NULL
return
BattleScript_KingsShieldEffect::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
seteffectsecondary
setmoveeffect 0
copybyte sBATTLER, gBattlerTarget
copybyte gBattlerTarget, gBattlerAttacker
copybyte gBattlerAttacker, sBATTLER
return
BattleScript_BanefulBunkerEffect::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_x100000
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
seteffectsecondary
setmoveeffect 0
return
BattleScript_CuteCharmActivates::
call BattleScript_AbilityPopUp
status2animation BS_ATTACKER, STATUS2_INFATUATION

View File

@ -300,8 +300,11 @@ extern const u8 BattleScript_PowderMoveNoEffect[];
extern const u8 BattleScript_GrassyTerrainLoop[];
extern const u8 BattleScript_VCreateStatLoss[];
extern const u8 BattleScript_SpikyShieldEffect[];
extern const u8 BattleScript_KingsShieldEffect[];
extern const u8 BattleScript_BanefulBunkerEffect[];
extern const u8 BattleScript_FlowerVeilProtectsRet[];
extern const u8 BattleScript_SweetVeilProtectsRet[];
extern const u8 BattleScript_MoveEffectCoreEnforcer[];
extern const u8 BattleScript_SelectingNotAllowedMoveThroatChop[];
extern const u8 BattleScript_MoveUsedIsThroatChopPrevented[];
extern const u8 BattleScript_SelectingNotAllowedMoveThroatChopInPalace[];

View File

@ -328,7 +328,7 @@
#define MOVE_EFFECT_SPECTRAL_THIEF 0x3F
#define MOVE_EFFECT_V_CREATE 0x40
#define MOVE_EFFECT_HAPPY_HOUR 0x41
#define MOVE_EFFECT_CORE_ENFORCER 0x42
#define MOVE_EFFECT_THROAT_CHOP 0x43
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -335,6 +335,7 @@
#define EFFECT_V_CREATE 329
#define EFFECT_MAT_BLOCK 330
#define EFFECT_STOMPING_TANTRUM 331
#define EFFECT_CORE_ENFORCER 332
#define EFFECT_THROAT_CHOP 334

View File

@ -162,7 +162,7 @@
#define ATK48_DONT_CHECK_LOWER 0x8
// atk49, moveend cases
#define ATK49_SPIKY_SHIELD 0
#define ATK49_PROTECT_LIKE_EFFECT 0
#define ATK49_RAGE 1
#define ATK49_DEFROST 2
#define ATK49_SYNCHRONIZE_TARGET 3

View File

@ -87,7 +87,7 @@ static const u8 sText_PkmnAlreadyAsleep[] = _("{B_DEF_NAME_WITH_PREFIX} is\nalre
static const u8 sText_PkmnAlreadyAsleep2[] = _("{B_ATK_NAME_WITH_PREFIX} is\nalready asleep!");
static const u8 sText_PkmnWasntAffected[] = _("{B_DEF_NAME_WITH_PREFIX}\nwasn't affected!");
static const u8 sText_PkmnWasPoisoned[] = _("{B_EFF_NAME_WITH_PREFIX}\nwas poisoned!");
static const u8 sText_PkmnPoisonedBy[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\npoisoned {B_EFF_NAME_WITH_PREFIX}!");
static const u8 sText_PkmnPoisonedBy[] = _("{B_EFF_NAME_WITH_PREFIX} was poisoned by\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_BUFF1}!");
static const u8 sText_PkmnHurtByPoison[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt\nby poison!");
static const u8 sText_PkmnAlreadyPoisoned[] = _("{B_DEF_NAME_WITH_PREFIX} is already\npoisoned.");
static const u8 sText_PkmnBadlyPoisoned[] = _("{B_EFF_NAME_WITH_PREFIX} is badly\npoisoned!");

View File

@ -2809,6 +2809,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_VCreateStatLoss;
break;
case MOVE_EFFECT_CORE_ENFORCER:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectCoreEnforcer;
}
break;
case MOVE_EFFECT_THROAT_CHOP:
gDisableStructs[gEffectBattler].throatChopTimer = 2;
gBattlescriptCurrInstr++;
@ -4218,19 +4225,37 @@ static void atk49_moveend(void)
{
switch (gBattleScripting.atk49_state)
{
case ATK49_SPIKY_SHIELD:
if (gProtectStructs[gBattlerTarget].spikyShielded
&& gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
case ATK49_PROTECT_LIKE_EFFECT:
if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT)
{
gMoveResultFlags &= ~(MOVE_RESULT_NO_EFFECT);
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_SPIKY_SHIELD);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SpikyShieldEffect;
effect = 1;
if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_SPIKY_SHIELD);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SpikyShieldEffect;
effect = 1;
}
else if (gProtectStructs[gBattlerTarget].kingsShielded)
{
i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_KingsShieldEffect;
effect = 1;
}
else if (gProtectStructs[gBattlerTarget].banefulBunkered)
{
gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BanefulBunkerEffect;
effect = 1;
}
}
gBattleScripting.atk49_state++;
break;

View File

@ -3314,6 +3314,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleScripting.moveEffect += MOVE_EFFECT_AFFECTS_USER;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_EFFECT_SPORE);
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
@ -3327,6 +3328,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
&& (Random() % 3) == 0)
{
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_POISON_POINT);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
@ -5668,6 +5670,9 @@ static inline void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType,
mod = UQ_4_12(2.0);
if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef))
mod = UQ_4_12(1.0);
if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT)
mod = UQ_4_12(1.0);
MulModifier(modifier, mod);
}

View File

@ -9124,7 +9124,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_CORE_ENFORCER] =
{
.effect = EFFECT_PLACEHOLDER,
.effect = EFFECT_CORE_ENFORCER,
.power = 100,
.type = TYPE_DRAGON,
.accuracy = 100,