Life Flame toxic orbs

This commit is contained in:
DizzyEggg 2019-05-10 11:03:33 +02:00
parent 875b413a09
commit d027bb0d7a
7 changed files with 89 additions and 8 deletions

View File

@ -2432,8 +2432,7 @@ BattleScript_EffectToxic::
jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected
jumpifflowerveil BattleScript_FlowerVeilProtects jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifsubstituteblocks BattleScript_ButItFailed jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus BS_TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpiftype BS_TARGET, TYPE_POISON, BattleScript_NotAffected jumpiftype BS_TARGET, TYPE_POISON, BattleScript_NotAffected
jumpiftype BS_TARGET, TYPE_STEEL, BattleScript_NotAffected jumpiftype BS_TARGET, TYPE_STEEL, BattleScript_NotAffected
@ -6020,6 +6019,18 @@ BattleScript_BufferEndTurn::
printstring STRINGID_BUFFERENDS printstring STRINGID_BUFFERENDS
waitmessage 0x40 waitmessage 0x40
end2 end2
BattleScript_ToxicOrb::
setbyte cMULTISTRING_CHOOSER, 0
copybyte gEffectBattler, gBattlerAttacker
call BattleScript_MoveEffectToxic
end2
BattleScript_FlameOrb::
setbyte cMULTISTRING_CHOOSER, 0
copybyte gEffectBattler, gBattlerAttacker
call BattleScript_MoveEffectBurn
end2
BattleScript_MoveEffectPoison:: BattleScript_MoveEffectPoison::
statusanimation BS_EFFECT_BATTLER statusanimation BS_EFFECT_BATTLER
@ -6860,15 +6871,19 @@ BattleScript_AirBaloonMsgPop::
removeitem BS_TARGET removeitem BS_TARGET
return return
BattleScript_ItemHurtEnd2:: BattleScript_ItemHurtRet::
playanimation BS_ATTACKER, B_ANIM_MON_HIT, NULL
waitanimation
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
printstring STRINGID_HURTBYITEM printstring STRINGID_HURTBYITEM
waitmessage 0x40 waitmessage 0x40
tryfaintmon BS_ATTACKER, FALSE, NULL tryfaintmon BS_ATTACKER, FALSE, NULL
return
BattleScript_ItemHurtEnd2::
playanimation BS_ATTACKER, B_ANIM_MON_HIT, NULL
waitanimation
call BattleScript_ItemHurtRet
end2 end2
BattleScript_ItemHealHP_Ret:: BattleScript_ItemHealHP_Ret::

View File

@ -169,6 +169,7 @@ struct SpecialStatus
u8 berryReduced:1; u8 berryReduced:1;
u8 gemBoost:1; u8 gemBoost:1;
u8 gemParam; u8 gemParam;
u8 damagedMons:4; // Mons that have been damaged directly by using a move, includes substitute.
s32 dmg; s32 dmg;
s32 physicalDmg; s32 physicalDmg;
s32 specialDmg; s32 specialDmg;

View File

@ -318,5 +318,8 @@ extern const u8 BattleScript_RockyHelmetActivates[];
extern const u8 BattleScript_ItemHurtEnd2[]; extern const u8 BattleScript_ItemHurtEnd2[];
extern const u8 BattleScript_AirBaloonMsgIn[]; extern const u8 BattleScript_AirBaloonMsgIn[];
extern const u8 BattleScript_AirBaloonMsgPop[]; extern const u8 BattleScript_AirBaloonMsgPop[];
extern const u8 BattleScript_ItemHurtRet[];
extern const u8 BattleScript_ToxicOrb[];
extern const u8 BattleScript_FlameOrb[];
#endif // GUARD_BATTLE_SCRIPTS_H #endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -26,6 +26,7 @@
#define ITEMEFFECT_MOVE_END 0x3 #define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4 #define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
#define ITEMEFFECT_TARGET 0x5 #define ITEMEFFECT_TARGET 0x5
#define ITEMEFFECT_ORBS 0x6
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK))) #define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))

View File

@ -182,8 +182,9 @@
#define ATK49_UPDATE_LAST_MOVES 16 #define ATK49_UPDATE_LAST_MOVES 16
#define ATK49_MIRROR_MOVE 17 #define ATK49_MIRROR_MOVE 17
#define ATK49_NEXT_TARGET 18 #define ATK49_NEXT_TARGET 18
#define ATK49_CLEAR_BITS 19 #define ATK49_LIFE_ORB 19
#define ATK49_COUNT 20 #define ATK49_CLEAR_BITS 20
#define ATK49_COUNT 21
#define BIT_HP 0x1 #define BIT_HP 0x1
#define BIT_ATK 0x2 #define BIT_ATK 0x2

View File

@ -1517,6 +1517,9 @@ static void atk07_adjustdamage(void)
END: END:
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMoveDamage >= 1)
gSpecialStatuses[gBattlerAttacker].damagedMons |= gBitTable[gBattlerTarget];
// Check gems and damage reducing berries. // Check gems and damage reducing berries.
if (gSpecialStatuses[gBattlerTarget].berryReduced if (gSpecialStatuses[gBattlerTarget].berryReduced
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
@ -4577,6 +4580,21 @@ static void atk49_moveend(void)
} }
gBattleScripting.atk49_state++; gBattleScripting.atk49_state++;
break; break;
case ATK49_LIFE_ORB:
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIFE_ORB
&& !(GetBattlerAbility(gBattlerAttacker) == ABILITY_SHEER_FORCE && gBattleMoves[gCurrentMove].flags & FLAG_SHEER_FORCE_BOOST)
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD
&& gSpecialStatuses[gBattlerAttacker].damagedMons)
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 10;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
effect = TRUE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHurtRet;
}
gBattleScripting.atk49_state++;
break;
case ATK49_CLEAR_BITS: // Clear bits active while using a move for all targets and all hits. case ATK49_CLEAR_BITS: // Clear bits active while using a move for all targets and all hits.
if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget) if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3; *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3;
@ -4584,6 +4602,7 @@ static void atk49_moveend(void)
gBattleStruct->ateBoost[gBattlerAttacker] = 0; gBattleStruct->ateBoost[gBattlerAttacker] = 0;
gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST); gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST);
gSpecialStatuses[gBattlerAttacker].gemBoost = 0; gSpecialStatuses[gBattlerAttacker].gemBoost = 0;
gSpecialStatuses[gBattlerAttacker].damagedMons = 0;
gSpecialStatuses[gBattlerTarget].berryReduced = 0; gSpecialStatuses[gBattlerTarget].berryReduced = 0;
gBattleScripting.atk49_state++; gBattleScripting.atk49_state++;
break; break;

View File

@ -1361,6 +1361,7 @@ enum
ENDTURN_TAUNT, ENDTURN_TAUNT,
ENDTURN_YAWN, ENDTURN_YAWN,
ENDTURN_ITEMS2, ENDTURN_ITEMS2,
ENDTURN_ORBS,
ENDTURN_ROOST, ENDTURN_ROOST,
ENDTURN_ELECTRIFY, ENDTURN_ELECTRIFY,
ENDTURN_POWDER, ENDTURN_POWDER,
@ -1430,6 +1431,11 @@ u8 DoBattlerEndTurnEffects(void)
effect++; effect++;
gBattleStruct->turnEffectsTracker++; gBattleStruct->turnEffectsTracker++;
break; break;
case ENDTURN_ORBS:
if (ItemBattleEffects(ITEMEFFECT_ORBS, gActiveBattler, FALSE))
effect++;
gBattleStruct->turnEffectsTracker++;
break;
case ENDTURN_LEECH_SEED: // leech seed case ENDTURN_LEECH_SEED: // leech seed
if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED) if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED)
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0 && gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0
@ -4173,6 +4179,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
} }
if (effect) if (effect)
{ {
gBattleScripting.battler = battlerId; gBattleScripting.battler = battlerId;
@ -4395,7 +4402,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker) && IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
{ {
gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp / 6; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 6;
if (gBattleMoveDamage == 0) if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1; gBattleMoveDamage = 1;
effect = ITEM_HP_CHANGE; effect = ITEM_HP_CHANGE;
@ -4462,6 +4469,40 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
} }
break; break;
case ITEMEFFECT_ORBS:
switch (battlerHoldEffect)
{
case HOLD_EFFECT_TOXIC_ORB:
if (!gBattleMons[battlerId].status1
&& !IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON) && !IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL)
&& GetBattlerAbility(battlerId) != ABILITY_IMMUNITY)
{
effect = ITEM_STATUS_CHANGE;
gBattleMons[battlerId].status1 = STATUS1_TOXIC_POISON;
BattleScriptExecute(BattleScript_ToxicOrb);
RecordItemEffectBattle(battlerId, battlerHoldEffect);
}
break;
case HOLD_EFFECT_FLAME_ORB:
if (!gBattleMons[battlerId].status1
&& !IS_BATTLER_OF_TYPE(battlerId, TYPE_FIRE)
&& GetBattlerAbility(battlerId) != ABILITY_WATER_VEIL)
{
effect = ITEM_STATUS_CHANGE;
gBattleMons[battlerId].status1 = STATUS1_BURN;
BattleScriptExecute(BattleScript_FlameOrb);
RecordItemEffectBattle(battlerId, battlerHoldEffect);
}
break;
}
if (effect == ITEM_STATUS_CHANGE)
{
gActiveBattler = battlerId;
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1);
MarkBattlerForControllerExec(gActiveBattler);
}
break;
} }
// Berry was successfully used on a Pokemon. // Berry was successfully used on a Pokemon.