summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/animations.asm6
-rw-r--r--engine/battle/core.asm4
-rw-r--r--engine/battle/effects.asm14
-rw-r--r--engine/battle/move_effects/haze.asm2
-rw-r--r--engine/battle/move_effects/substitute.asm2
-rw-r--r--engine/battle/trainer_ai.asm3
6 files changed, 17 insertions, 14 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 56db1979..81468a39 100644
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -419,7 +419,7 @@ MoveAnimation:
.moveAnimation
; check if battle animations are disabled in the options
ld a, [wOptions]
- bit 7, a
+ bit BIT_BATTLE_ANIMATION, a
jr nz, .animationsDisabled
call ShareMoveAnimations
call PlayAnimation
@@ -701,7 +701,7 @@ INCLUDE "data/battle_anims/special_effects.asm"
DoBallTossSpecialEffects:
ld a, [wcf91]
- cp 3 ; is it a Master Ball or Ultra Ball?
+ cp ULTRA_BALL + 1 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
ldh a, [rOBP0]
@@ -717,7 +717,7 @@ DoBallTossSpecialEffects:
call PlaySound
.skipPlayingSound
ld a, [wIsInBattle]
- cp 02 ; is it a trainer battle?
+ cp 2 ; is it a trainer battle?
jr z, .isTrainerBattle
ld a, [wd11e]
cp $10 ; is the enemy pokemon the Ghost Marowak?
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 882f3f8e..fa1a8d56 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -3602,7 +3602,7 @@ CheckPlayerStatusConditions:
ld hl, wPlayerBattleStatus1
ld a, [hl]
; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage)
- and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
+ and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
ld [hl], a
ld a, [wPlayerMoveEffect]
cp FLY_EFFECT
@@ -6120,7 +6120,7 @@ CheckEnemyStatusConditions:
ld hl, wEnemyBattleStatus1
ld a, [hl]
; clear bide, thrashing about, charging up, and multi-turn moves such as warp
- and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
+ and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
ld [hl], a
ld a, [wEnemyMoveEffect]
cp FLY_EFFECT
diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm
index 959f7eaf..f2e2590c 100644
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -108,10 +108,10 @@ PoisonEffect:
jr z, .noEffect
ld a, [de]
cp POISON_SIDE_EFFECT1
- ld b, $34 ; ~20% chance of poisoning
+ ld b, 20 percent + 1 ; chance of poisoning
jr z, .sideEffectTest
cp POISON_SIDE_EFFECT2
- ld b, $67 ; ~40% chance of poisoning
+ ld b, 40 percent + 1 ; chance of poisoning
jr z, .sideEffectTest
push hl
push de
@@ -584,7 +584,7 @@ StatModifierDownEffect:
cp LINK_STATE_BATTLING
jr z, .statModifierDownEffect
call BattleRandom
- cp $40 ; 1/4 chance to miss by in regular battle
+ cp 25 percent + 1 ; chance to miss by in regular battle
jp c, MoveMissed
.statModifierDownEffect
call CheckTargetSubstitute ; can't hit through substitute
@@ -593,7 +593,7 @@ StatModifierDownEffect:
cp ATTACK_DOWN_SIDE_EFFECT
jr c, .nonSideEffect
call BattleRandom
- cp $55 ; 85/256 chance for side effects
+ cp 33 percent + 1 ; chance for side effects
jp nc, CantLowerAnymore
ld a, [de]
sub ATTACK_DOWN_SIDE_EFFECT ; map each stat to 0-3
@@ -1018,9 +1018,9 @@ FlinchSideEffect:
call z, ClearHyperBeam
ld a, [de]
cp FLINCH_SIDE_EFFECT1
- ld b, $1a ; ~10% chance of flinch
+ ld b, 10 percent + 1 ; chance of flinch (FLINCH_SIDE_EFFECT1)
jr z, .gotEffectChance
- ld b, $4d ; ~30% chance of flinch
+ ld b, 30 percent + 1 ; chance of flinch otherwise
.gotEffectChance
call BattleRandom
cp b
@@ -1167,7 +1167,7 @@ RecoilEffect:
ConfusionSideEffect:
call BattleRandom
- cp $19 ; ~10% chance
+ cp 10 percent ; chance of confusion
ret nc
jr ConfusionSideEffectSuccess
diff --git a/engine/battle/move_effects/haze.asm b/engine/battle/move_effects/haze.asm
index 915eeed8..c15c848b 100644
--- a/engine/battle/move_effects/haze.asm
+++ b/engine/battle/move_effects/haze.asm
@@ -51,7 +51,7 @@ CureVolatileStatuses:
inc hl ; BATTSTATUS2
ld a, [hl]
; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses
- and $ff ^((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
+ and ~((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
ld [hli], a ; BATTSTATUS3
ld a, [hl]
and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses
diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm
index 860b76b6..b1fd8ac2 100644
--- a/engine/battle/move_effects/substitute.asm
+++ b/engine/battle/move_effects/substitute.asm
@@ -45,7 +45,7 @@ SubstituteEffect_:
ld l, c
set HAS_SUBSTITUTE_UP, [hl]
ld a, [wOptions]
- bit 7, a ; battle animation is enabled?
+ bit BIT_BATTLE_ANIMATION, a
ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)
jr z, .animationEnabled
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 3efbeeda..4048e808 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -351,7 +351,10 @@ CooltrainerMAI:
jp AIUseXAttack
CooltrainerFAI:
+ ; The intended 25% chance to consider switching will not apply.
+ ; Uncomment the line below to fix this.
cp 25 percent + 1
+ ; ret nc
ld a, 10
call AICheckIfHPBelowFraction
jp c, AIUseHyperPotion