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
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus BS_TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpiftype BS_TARGET, TYPE_POISON, BattleScript_NotAffected
jumpiftype BS_TARGET, TYPE_STEEL, BattleScript_NotAffected
@ -6021,6 +6020,18 @@ BattleScript_BufferEndTurn::
waitmessage 0x40
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::
statusanimation BS_EFFECT_BATTLER
printfromtable gGotPoisonedStringIds
@ -6860,15 +6871,19 @@ BattleScript_AirBaloonMsgPop::
removeitem BS_TARGET
return
BattleScript_ItemHurtEnd2::
playanimation BS_ATTACKER, B_ANIM_MON_HIT, NULL
waitanimation
BattleScript_ItemHurtRet::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
printstring STRINGID_HURTBYITEM
waitmessage 0x40
tryfaintmon BS_ATTACKER, FALSE, NULL
return
BattleScript_ItemHurtEnd2::
playanimation BS_ATTACKER, B_ANIM_MON_HIT, NULL
waitanimation
call BattleScript_ItemHurtRet
end2
BattleScript_ItemHealHP_Ret::

View File

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

View File

@ -318,5 +318,8 @@ extern const u8 BattleScript_RockyHelmetActivates[];
extern const u8 BattleScript_ItemHurtEnd2[];
extern const u8 BattleScript_AirBaloonMsgIn[];
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

View File

@ -26,6 +26,7 @@
#define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
#define ITEMEFFECT_TARGET 0x5
#define ITEMEFFECT_ORBS 0x6
#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_MIRROR_MOVE 17
#define ATK49_NEXT_TARGET 18
#define ATK49_CLEAR_BITS 19
#define ATK49_COUNT 20
#define ATK49_LIFE_ORB 19
#define ATK49_CLEAR_BITS 20
#define ATK49_COUNT 21
#define BIT_HP 0x1
#define BIT_ATK 0x2

View File

@ -1517,6 +1517,9 @@ static void atk07_adjustdamage(void)
END:
gBattlescriptCurrInstr++;
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMoveDamage >= 1)
gSpecialStatuses[gBattlerAttacker].damagedMons |= gBitTable[gBattlerTarget];
// Check gems and damage reducing berries.
if (gSpecialStatuses[gBattlerTarget].berryReduced
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
@ -4577,6 +4580,21 @@ static void atk49_moveend(void)
}
gBattleScripting.atk49_state++;
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.
if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3;
@ -4584,6 +4602,7 @@ static void atk49_moveend(void)
gBattleStruct->ateBoost[gBattlerAttacker] = 0;
gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST);
gSpecialStatuses[gBattlerAttacker].gemBoost = 0;
gSpecialStatuses[gBattlerAttacker].damagedMons = 0;
gSpecialStatuses[gBattlerTarget].berryReduced = 0;
gBattleScripting.atk49_state++;
break;

View File

@ -1361,6 +1361,7 @@ enum
ENDTURN_TAUNT,
ENDTURN_YAWN,
ENDTURN_ITEMS2,
ENDTURN_ORBS,
ENDTURN_ROOST,
ENDTURN_ELECTRIFY,
ENDTURN_POWDER,
@ -1430,6 +1431,11 @@ u8 DoBattlerEndTurnEffects(void)
effect++;
gBattleStruct->turnEffectsTracker++;
break;
case ENDTURN_ORBS:
if (ItemBattleEffects(ITEMEFFECT_ORBS, gActiveBattler, FALSE))
effect++;
gBattleStruct->turnEffectsTracker++;
break;
case ENDTURN_LEECH_SEED: // leech seed
if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED)
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0
@ -4173,6 +4179,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
}
if (effect)
{
gBattleScripting.battler = battlerId;
@ -4395,7 +4402,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp / 6;
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 6;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
effect = ITEM_HP_CHANGE;
@ -4462,6 +4469,40 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
}
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.