mirror of
				https://github.com/thornAvery/jep-hack.git
				synced 2025-11-04 21:01:01 +13:00 
			
		
		
		
	Add move effect for Coin Hurl
Thanks to Shellnuts for helping out. Coin Hurl is now a max-150 base power move that scales with the user's wealth.
This commit is contained in:
		
							parent
							
								
									1f0cc46814
								
							
						
					
					
						commit
						caee1c278c
					
				| 
						 | 
				
			
			@ -157,4 +157,5 @@
 | 
			
		|||
	const EFFECT_BEAT_UP
 | 
			
		||||
	const EFFECT_FLY
 | 
			
		||||
	const EFFECT_DEFENSE_CURL
 | 
			
		||||
	const EFFECT_COIN_HURL
 | 
			
		||||
DEF NUM_MOVE_EFFECTS EQU const_value
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,4 +20,5 @@ UsefulMoves:
 | 
			
		|||
	dw FIRE_BLAST
 | 
			
		||||
	dw SOFTBOILED
 | 
			
		||||
	dw SUPER_FANG
 | 
			
		||||
	dw COIN_HURL
 | 
			
		||||
	dw -1 ; end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,4 +180,5 @@ BattleCommandPointers:
 | 
			
		|||
	dw BattleCommand_SuperEffectiveLoopText
 | 
			
		||||
	dw BattleCommand_StartLoop
 | 
			
		||||
	dw BattleCommand_Curl
 | 
			
		||||
	dw BattleCommand_CoinHurlPower
 | 
			
		||||
	assert_table_length NUM_EFFECT_COMMANDS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2077,3 +2077,23 @@ DefenseCurl:
 | 
			
		|||
	statupmessage
 | 
			
		||||
	statupfailtext
 | 
			
		||||
	endmove
 | 
			
		||||
 | 
			
		||||
CoinHurl: ; Identical to Return, except it calculates damage differently, and does not trigger King's Rock, as contact isn't being made.
 | 
			
		||||
	checkobedience
 | 
			
		||||
	usedmovetext
 | 
			
		||||
	doturn
 | 
			
		||||
	critical
 | 
			
		||||
	damagestats
 | 
			
		||||
	coinhurlpower
 | 
			
		||||
	damagecalc
 | 
			
		||||
	stab
 | 
			
		||||
	damagevariation
 | 
			
		||||
	checkhit
 | 
			
		||||
	moveanim
 | 
			
		||||
	failuretext
 | 
			
		||||
	applydamage
 | 
			
		||||
	criticaltext
 | 
			
		||||
	supereffectivetext
 | 
			
		||||
	checkfaint
 | 
			
		||||
	buildopponentrage
 | 
			
		||||
	endmove
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,4 +158,5 @@ MoveEffectsPointers:
 | 
			
		|||
	dw BeatUp
 | 
			
		||||
	dw Fly
 | 
			
		||||
	dw DefenseCurl
 | 
			
		||||
	dw CoinHurl
 | 
			
		||||
	assert_table_length NUM_MOVE_EFFECTS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -276,7 +276,7 @@ Moves1:
 | 
			
		|||
	move EFFECT_FREEZE_HIT,        100, ICE,         	95,  5,  30      ;MYSTIC_ICE
 | 
			
		||||
	move EFFECT_FLY,                85, WATER,         85,  5,   0     ; BOUNCE - went back and forth on type (making it modern or keeping it spaceworldy), chose spaceworld to diversify the "fly" move category
 | 
			
		||||
	move EFFECT_ACCURACY_UP,        85, GRASS,         	 0, 20,   0     ; BRIGHT_MOSS
 | 
			
		||||
	move EFFECT_RETURN,              1, NORMAL,        100, 20,   0     ; COIN_HURL - effect not implemented
 | 
			
		||||
	move EFFECT_COIN_HURL,           1, NORMAL,        100, 20,   0     ; COIN_HURL
 | 
			
		||||
	move EFFECT_NORMAL_HIT,         85, GROUND,        100, 10,   0     ; UPROOT
 | 
			
		||||
	move EFFECT_MIRROR_COAT,         1, PSYCHIC_TYPE,  100, 10,   0     ; SYNCHRONIZE - effect not implemented
 | 
			
		||||
	move EFFECT_ATTACK_UP_HIT,      70, STEEL,         	90, 10,  10     ; STRONG_ARM
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1205,7 +1205,7 @@ PersianEvosAttacks:
 | 
			
		|||
	dbw 43, SLASH
 | 
			
		||||
	dbw 50, DOUBLE_TEAM ; KEP
 | 
			
		||||
	dbw 56, BODY_SLAM ; RBY TM
 | 
			
		||||
	; dbw 61, COIN_HURL
 | 
			
		||||
	dbw 61, COIN_HURL
 | 
			
		||||
	db 0 ; no more level-up moves
 | 
			
		||||
 | 
			
		||||
PerrserkerEvosAttacks:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6450,6 +6450,8 @@ INCLUDE "engine/battle/move_effects/attract.asm"
 | 
			
		|||
 | 
			
		||||
INCLUDE "engine/battle/move_effects/return.asm"
 | 
			
		||||
 | 
			
		||||
INCLUDE "engine/battle/move_effects/coin_hurl.asm"
 | 
			
		||||
 | 
			
		||||
INCLUDE "engine/battle/move_effects/present.asm"
 | 
			
		||||
 | 
			
		||||
INCLUDE "engine/battle/move_effects/frustration.asm"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										56
									
								
								engine/battle/move_effects/coin_hurl.asm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								engine/battle/move_effects/coin_hurl.asm
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
; Checks the user's money and divides by 100.
 | 
			
		||||
; Caps at base 150 power, from 15,000 yen, which is 00000000-00111010-10011000 in binary (the player's money box). This is achieved through skipping the calculation at a certain point.
 | 
			
		||||
; Against an enemy Pokemon, they'll always have base 90 Power.
 | 
			
		||||
 | 
			
		||||
; Given the way this works, Coin Hurl will rise in power *very* quickly, but, likewise, also reward good fiscal responsibility from the player. At 3,000 yen, it's almost useless. At 10,000 yen, you have max power Return.
 | 
			
		||||
 | 
			
		||||
; This move is only learned by Persian and Belledam. Persian has 75 Attack and is basically useless without the move; this gives it an RBY Slash-like counterpart to bring it back to its roots. Belledam, on the other hand, doesn't get STAB, so it's just a (very good) Double-Edge alternative. I really like this!
 | 
			
		||||
 | 
			
		||||
; To change scaling, simply change which bytes are checked for the cap, and work from there. Alternatively, change the division process, and so on. Lots of ways, ours is very simple.
 | 
			
		||||
 | 
			
		||||
; Have fun using Coin Hurl! - PvK
 | 
			
		||||
 | 
			
		||||
BattleCommand_CoinHurlPower:
 | 
			
		||||
	push bc
 | 
			
		||||
	ld hl, wMoney
 | 
			
		||||
	
 | 
			
		||||
	ld a, [wLinkMode]
 | 
			
		||||
	and a
 | 
			
		||||
	jr nz, .linked ; To test max power in the Debug Room, set to z.
 | 
			
		||||
	
 | 
			
		||||
	ldh a, [hBattleTurn]
 | 
			
		||||
	and a
 | 
			
		||||
	jr z, .ok
 | 
			
		||||
	jr .enemyMon ; If you're fighting an enemy Pokemon, then skip the calculation and force base 90 Power. We've already checked the link mode, so this only works in PvP.
 | 
			
		||||
.ok
 | 
			
		||||
	
 | 
			
		||||
	; Cap at base 150 power
 | 
			
		||||
	; There's no multi-byte compare instruction by default so we're doing it in a really funny way
 | 
			
		||||
	; s/o Shellnuts for helping!
 | 
			
		||||
	ld a, [wMoney] ; check high byte
 | 
			
		||||
	cp %00000001
 | 
			
		||||
	jr c, .linked ; if there's a 1 in here at all, just skip the calculation entirely, because you're over 15,000.
 | 
			
		||||
	ld a, [wMoney+1] ; check middle byte
 | 
			
		||||
	cp %00111010
 | 
			
		||||
	jr c, .linked ; Fuck off again if you're at the initial total.
 | 
			
		||||
	ld a, [wMoney+2] ; low byte, you can get here sometimes
 | 
			
		||||
	cp %10011000
 | 
			
		||||
	jr c, .linked
 | 
			
		||||
	xor a
 | 
			
		||||
	
 | 
			
		||||
	ld a, 100 ; Take current money and divide it by 100.
 | 
			
		||||
	ldh [hDivisor], a
 | 
			
		||||
	ld b, 4
 | 
			
		||||
	call Divide
 | 
			
		||||
	ldh a, [hQuotient + 3]
 | 
			
		||||
	ld d, a
 | 
			
		||||
	jr .end
 | 
			
		||||
.enemyMon ; Against an enemy Pokemon, base 75 power.
 | 
			
		||||
	ld d, 90
 | 
			
		||||
	jr .end
 | 
			
		||||
.linked ; In a Link Battle, it's always base 150 power. We also skip here if the player's money is over 15,000 yen.
 | 
			
		||||
	ld d, 150
 | 
			
		||||
	; fallthrough
 | 
			
		||||
.end
 | 
			
		||||
	pop bc
 | 
			
		||||
	ret
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +180,7 @@ ENDM
 | 
			
		|||
	command supereffectivelooptext  ; ad
 | 
			
		||||
	command startloop               ; ae
 | 
			
		||||
	command curl                    ; af
 | 
			
		||||
	command coinhurlpower
 | 
			
		||||
DEF NUM_EFFECT_COMMANDS EQU const_value - 1
 | 
			
		||||
 | 
			
		||||
	const_def -1, -1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue