diff options
author | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2020-05-13 17:30:24 +0100 |
---|---|---|
committer | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2020-12-16 00:22:16 +0000 |
commit | b18a90284bed0f381c924c1bd9bddc6f254ad36c (patch) | |
tree | 3bdfcaa2a6caf919b08f911896138bfe5981dd9b /src | |
parent | 5d155daebbd51d2346046e42694c4893fc1d8dbb (diff) |
Finish Grass effects
Diffstat (limited to 'src')
-rw-r--r-- | src/constants/duel_constants.asm | 13 | ||||
-rw-r--r-- | src/data/effect_commands.asm | 32 | ||||
-rw-r--r-- | src/engine/effect_functions.asm | 324 | ||||
-rw-r--r-- | src/hram.asm | 2 | ||||
-rw-r--r-- | src/text/text1.asm | 4 | ||||
-rw-r--r-- | src/text/text2.asm | 2 | ||||
-rw-r--r-- | src/text/text_offsets.asm | 6 |
7 files changed, 352 insertions, 31 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 89e61a4..ff9da29 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -45,12 +45,12 @@ DUELVARS_BENCH2_CARD_STAGE EQUS "LOW(wPlayerBench2CardStage)" DUELVARS_BENCH3_CARD_STAGE EQUS "LOW(wPlayerBench3CardStage)" ; d1 DUELVARS_BENCH4_CARD_STAGE EQUS "LOW(wPlayerBench4CardStage)" ; d2 DUELVARS_BENCH5_CARD_STAGE EQUS "LOW(wPlayerBench5CardStage)" ; d3 -DUELVARS_ARENA_CARD_CHANGED_COLOR EQUS "LOW(wPlayerArenaCardChangedColor)" ; d4 -DUELVARS_BENCH1_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench1CardChangedColor)" ; d5 -DUELVARS_BENCH2_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench2CardChangedColor)" ; d6 -DUELVARS_BENCH3_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench3CardChangedColor)" ; d7 -DUELVARS_BENCH4_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench4CardChangedColor)" ; d8 -DUELVARS_BENCH5_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench5CardChangedColor)" ; d9 +DUELVARS_ARENA_CARD_CHANGED_COLOR EQUS "LOW(wPlayerArenaCardChangedColor)" ; d4 +DUELVARS_BENCH1_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench1CardChangedColor)" ; d5 +DUELVARS_BENCH2_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench2CardChangedColor)" ; d6 +DUELVARS_BENCH3_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench3CardChangedColor)" ; d7 +DUELVARS_BENCH4_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench4CardChangedColor)" ; d8 +DUELVARS_BENCH5_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench5CardChangedColor)" ; d9 DUELVARS_ARENA_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerArenaCardAttachedDefender)" ; da DUELVARS_BENCH1_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench1CardAttachedDefender)" ; db DUELVARS_BENCH2_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench2CardAttachedDefender)" ; dc @@ -163,6 +163,7 @@ SUBSTATUS3_HEADACHE EQU 1 ; DUELVARS_ARENA_CARD_FLAGS_C2 constants USED_PKMN_POWER_THIS_TURN_F EQU 5 CAN_EVOLVE_THIS_TURN_F EQU 7 + USED_PKMN_POWER_THIS_TURN EQU 1 << USED_PKMN_POWER_THIS_TURN_F CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm index af6d821..4dbc04a 100644 --- a/src/data/effect_commands.asm +++ b/src/data/effect_commands.asm @@ -297,8 +297,8 @@ VenomothShiftEffectCommands: db $00 VenomothVenomPowderEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4d8c - dbw EFFECTCMDTYPE_AI, $4d84 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, VenomPowder_PoisonConfusion50PercentEffect + dbw EFFECTCMDTYPE_AI, VenomPowder_AIEffect db $00 TangelaBindEffectCommands: @@ -307,17 +307,17 @@ TangelaBindEffectCommands: TangelaPoisonPowderEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4da0 + dbw EFFECTCMDTYPE_AI, TangelaPoisonPowder_AIEffect db $00 VileplumeHealEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4da8 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4dc7 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Heal_OncePerTurnCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Heal_RemoveDamageEffect db $00 VileplumePetalDanceEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4e2b - dbw EFFECTCMDTYPE_AI, $4e23 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PetalDance_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PetalDance_AIEffect db $00 TangelaStunSporeEffectCommands: @@ -326,30 +326,30 @@ TangelaStunSporeEffectCommands: TangelaPoisonWhipEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4e4b + dbw EFFECTCMDTYPE_AI, PoisonWhip_AIEffect db $00 VenusaurSolarPowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4e53 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4e82 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, SolarPower_CheckUse + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SolarPower_RemoveStatusEffect db $00 VenusaurMegaDrainEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4eb0 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, VenusaurMegaDrainEffect db $00 OmastarWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f05 - dbw EFFECTCMDTYPE_AI, $4f05 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OmastarWaterGunEffect + dbw EFFECTCMDTYPE_AI, OmastarWaterGunEffect db $00 OmastarSpikeCannonEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f12 - dbw EFFECTCMDTYPE_AI, $4f0a + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OmastarSpikeCannon_MultiplierEffect + dbw EFFECTCMDTYPE_AI, OmastarSpikeCannon_AIEffect db $00 OmanyteClairvoyanceEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4f2a + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ClairvoyanceEffect db $00 OmanyteWaterGunEffectCommands: diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 8b08135..974cd22 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -388,7 +388,25 @@ ApplyAndAnimateHPDrain: ; 2c221 (b:4221) ret ; 0x2c25b - INCROM $2c25b, $2c2a4 +; returns carry if Play Area has no damage counters. +CheckIfPlayAreaHasAnyDamage: ; 2c25b (b:425b) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld e, PLAY_AREA_ARENA +.loop_play_area + call GetCardDamageAndMaxHP + or a + ret nz ; found damage + inc e + dec d + jr nz, .loop_play_area + ; no damage found + scf + ret +; 0x2c26e + + INCROM $2c26e, $2c2a4 ; makes a list in wDuelTempList with the deck indices ; of all the energy cards found in opponent's Discard Pile. @@ -2118,7 +2136,308 @@ Shift_ChangeColorEffect: ; 2cd5d (b:4d5d) ret ; 0x2cd84 - INCROM $2cd84, $2f4e1 +VenomPowder_AIEffect: ; 2cd84 (b:4d84) + ld a, 5 + lb de, 0, 10 + jp Func_2c0e9 +; 0x2cd8c + +VenomPowder_PoisonConfusion50PercentEffect: ; 2cd8c (b:4d8c) + ldtx de, VenomPowderCheckText + call TossCoin_BankB + ret nc ; return if tails + +; heads + call PoisonEffect + call ConfusionEffect + ret c + ld a, CONFUSED | POISONED + ld [wNoEffectFromStatus], a + ret +; 0x2cda0 + +TangelaPoisonPowder_AIEffect: ; 2cda0 (b:4da0) + ld a, 5 + lb de, 0, 10 + jp StoreAIPoisonDamageInfo +; 0x2cda8 + +Heal_OncePerTurnCheck: ; 2cda8 (b:4da8) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS_C2 + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + ret c ; no damage counters to heal + + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret + +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +; 0x2cdc7 + +Heal_RemoveDamageEffect: ; 2cdc7 (b:4dc7) + ldtx de, IfHeadsHealIsSuccessfulText + call TossCoin_BankB + ldh [hTempPlayAreaLocation_ffa1], a + jr nc, .done + + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_LINK_OPP + jr z, .link_opp + and DUELIST_TYPE_AI_OPP + jr nz, .done + +; player + ldtx hl, ChoosePkmnToRemoveDamageCounterText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInPlayArea +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hHealPlayAreaLocationTarget], a + ld e, a + call GetCardDamageAndMaxHP + or a + jr z, .loop_input ; has no damage counters + ldh a, [hTempPlayAreaLocation_ff9d] + call SerialSend8Bytes + jr .done + +.link_opp + call SerialRecv8Bytes + ldh [hHealPlayAreaLocationTarget], a + ; fallthrough + +.done + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS_C2 + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + ldh a, [hTempPlayAreaLocation_ffa1] + or a + ret z + + ldh a, [hHealPlayAreaLocationTarget] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add 10 ; remove 1 damage counter + ld [hl], a + ldh a, [hHealPlayAreaLocationTarget] + call Func_2c10b + call ExchangeRNG + ret +; 0x2ce23 + +PetalDance_AIEffect: ; 2ce23 (b:4e23) + ld a, 60 + lb de, 0, 120 + jp StoreAIDamageInfo +; 0x2ce2b + +PetalDance_MultiplierEffect: ; 2ce2b (b:4e2b) + ld hl, 40 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + add a + add a + call ATimes10 + ; a = 4 * 10 * heads + call StoreDamageInfo + call SwapTurn + call ConfusionEffect + call SwapTurn + ret +; 0x2ce4b + +PoisonWhip_AIEffect: ; 2ce4b (b:4e4b) + ld a, 10 + lb de, 10, 10 + jp StoreAIPoisonDamageInfo +; 0x2ce53 + +SolarPower_CheckUse: ; 2ce53 (b:4e53) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS_C2 + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c ; can't use PKMN due to status or Toxic Gas + +; return carry if none of the Arena cards have status conditions + ld a, DUELVARS_ARENA_CARD_STATUS + call GetTurnDuelistVariable + or a + jr nz, .has_status + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + or a + jr z, .no_status +.has_status + or a + ret +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +.no_status + ldtx hl, NotAffectedByPoisonSleepParalysisOrConfusionText + scf + ret +; 0x2ce82 + +SolarPower_RemoveStatusEffect: ; 2ce82 (b:4e82) + ld a, $8e + ld [wLoadedMoveAnimation], a + bank1call Func_7415 + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $00 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS_C2 + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + ld l, DUELVARS_ARENA_CARD_STATUS + ld [hl], NO_STATUS + + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + ld [hl], NO_STATUS + bank1call DrawDuelHUDs + ret +; 0x2ceb0 + +VenusaurMegaDrainEffect: ; 2ceb0 (b:4eb0) + ld hl, wDealtDamage + ld a, [hli] + ld h, [hl] + ld l, a + srl h + rr l + bit 0, l + jr z, .rounded + ; round up to nearest 10 + ld de, 10 / 2 + add hl, de +.rounded + ld e, l + ld d, h + call ApplyAndAnimateHPDrain + ret +; 0x2cec8 + +; applies the damage bonus for attacks that get bonus +; from extra Water energy cards. +; this bonus is always 10 more damage for each extra Water energy +; and is always capped at a maximum of 20 damage. +; input: +; b = number of Water energy cards needed for paying Energy Cost +; c = number of colorless energy cards needed for paying Energy Cost +ApplyExtraWaterEnergyDamageBonus: ; 2cec8 (b:4ec8) + ld a, [wccf0] + or a + jr z, .asm_2ced1 + ld c, a + ld b, 0 + +.asm_2ced1 + push bc + ldh a, [hTempPlayAreaLocation_ff9d] + ld e, a + call GetPlayAreaCardAttachedEnergies + pop bc + + ld hl, wAttachedEnergies + WATER + ld a, c + or a + jr z, .check_bonus ; is Energy cost all water energy? + + ; it's not, so we need to remove the + ; Water energy cards from calculations + ; if they pay for colorless instead. + ld a, [wTotalAttachedEnergies] + cp [hl] + jr nz, .check_bonus ; skip if at least 1 non-Water energy attached + + ; Water is the only energy color attached + ld a, c + add b + ld b, a + ; b += c + +.check_bonus + ld a, [hl] + sub b + jr c, .skip_bonus ; is water energy < b? + jr z, .skip_bonus ; is water energy == b? + +; a holds number of water energy not payed for energy cost + cp 3 + jr c, .less_than_3 + ld a, 2 ; cap this to 2 for bonus effect +.less_than_3 + call ATimes10 + call AddToDamage ; add 10 * a to damage + +.skip_bonus + ld a, [wDamage] + ld [wAIMinDamage], a + ld [wAIMaxDamage], a + ret +; 0x2cf05 + +OmastarWaterGunEffect: ; 2cf05 (b:4f05) + lb bc, 1, 1 + jr ApplyExtraWaterEnergyDamageBonus +; 0x2cf0a + +OmastarSpikeCannon_AIEffect: ; 2cf0a (b:4f0a) + ld a, 30 + lb de, 0, 60 + jp StoreAIDamageInfo +; 0x2cf12 + +OmastarSpikeCannon_MultiplierEffect: ; 2cf12 (b:4f12) + ld hl, 30 + call LoadTxRam3 + ld a, 2 + ldtx de, DamageCheckIfHeadsXDamageText + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call StoreDamageInfo ; 3 * 10 * heads + ret +; 0x2cf2a + +ClairvoyanceEffect: ; 2cf2a (b:4f2a) + scf + ret +; 0x2cf2c + + INCROM $2cf2c, $2f4e1 ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) call SwapTurn @@ -2149,4 +2468,3 @@ ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) ; 0x2f513 INCROM $2f513, $30000 - diff --git a/src/hram.asm b/src/hram.asm index 96230d7..972fb2f 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -99,6 +99,8 @@ NEXTU ; the deck index (0-59) of the energy card to transfer ; and the Play Area location (PLAY_AREA_*) of card to receive that energy card. hAIEnergyTransEnergyCard:: ; ffa2 +; PLAY_AREA_* constant of Pokemon to be affected by Heal PKMN Power +hHealPlayAreaLocationTarget:: ; ffa2 ds $1 hAIEnergyTransPlayAreaLocation:: ; ffa3 ds $1 diff --git a/src/text/text1.asm b/src/text/text1.asm index 1cb1e0a..e391fa4 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -849,7 +849,7 @@ CantEvolvePokemonInSameTurnItsPlacedText: ; 37546 (d:7546) line "in the same turn it was placed." done -Text00b5: ; 37583 (d:7583) +NotAffectedByPoisonSleepParalysisOrConfusionText: ; 37583 (d:7583) text "Not affected by Poison," line "Sleep, Paralysis, or Confusion." done @@ -1108,7 +1108,7 @@ IfHeadsChangeOpponentsActivePokemonText: ; 37e46 (d:7e46) line "Active Pokémon." done -Text00ec: ; 37e73 (d:7e73) +IfHeadsHealIsSuccessfulText: ; 37e73 (d:7e73) text "If Heads," line "Heal is successful." done diff --git a/src/text/text2.asm b/src/text/text2.asm index 1afa4d8..1195ac6 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -298,7 +298,7 @@ ChooseABellsproutText: ; 38bb3 (e:4bb3) text "Choose a Bellsprout." done -Text0130: ; 38bc9 (e:4bc9) +ChoosePkmnToRemoveDamageCounterText: ; 38bc9 (e:4bc9) text "Choose a Pokémon to remove" line "the Damage counter from." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index e0c3cb8..ee5dfce 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -182,7 +182,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer NoSpaceOnTheBenchText ; 0x00b2 textpointer NoPokemonCapableOfEvolvingText ; 0x00b3 textpointer CantEvolvePokemonInSameTurnItsPlacedText ; 0x00b4 - textpointer Text00b5 ; 0x00b5 + textpointer NotAffectedByPoisonSleepParalysisOrConfusionText ; 0x00b5 textpointer Text00b6 ; 0x00b6 textpointer LureNoPokemonOnTheBenchText ; 0x00b7 textpointer Text00b8 ; 0x00b8 @@ -237,7 +237,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer IfHeadPlus10IfTails10ToYourselfText ; 0x00e9 textpointer Text00ea ; 0x00ea textpointer IfHeadsChangeOpponentsActivePokemonText ; 0x00eb - textpointer Text00ec ; 0x00ec + textpointer IfHeadsHealIsSuccessfulText ; 0x00ec textpointer Text00ed ; 0x00ed textpointer Text00ee ; 0x00ee textpointer TrainerCardSuccessCheckText ; 0x00ef @@ -305,7 +305,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer ProcedureForEnergyTransferText ; 0x012d textpointer ChooseABellsproutFromDeckText ; 0x012e textpointer ChooseABellsproutText ; 0x012f - textpointer Text0130 ; 0x0130 + textpointer ChoosePkmnToRemoveDamageCounterText ; 0x0130 textpointer Text0131 ; 0x0131 textpointer Text0132 ; 0x0132 textpointer Text0133 ; 0x0133 |