Users browsing this thread: 1 Guest(s)
Giving Everyone the Same Desperation Attack

#10
Posts: 617
Threads: 49
Thanks Received: 0
Thanks Given: 5
Joined: Feb 2017
Reputation: 25
Status
None
Timbo, that's the current state. There is no longer a check for characters. Even guest characters like Ghost will use this routine.

Note that I discovered a gross oversight in the routine. I write to the D.A. ram byte before I've confirmed that the attack is possible. I'll re-write sometime later today.

Okay, I was able to fix the code. I realized that I would need to duplicate the code for writing the character's D.A. bit if I were to move it to where it SHOULD be, which would mean expanding this routine beyond its current bounds. After testing several variations of desperation attacks, I've decided that I don't have a compelling reason to add a Lvl 2. Rather, I've changed the code so that there is a 1 in 16 chance for a Desperation Attack (like normal), but if the attacker is the last character standing, that probability jumps to 1 in 4. Here is the code that I will be using in my game. (Note, I'm also nopping out C2/453B so that near fatal triggers at 1/4th HP, not 1/8th.)

Code:
;(Fight - check for Desperation attack)

;Check for D.A. Eligibility
C2/15C8: C0 08        CPY #$08
C2/15CA: B0 44        BCS $1610      (No Desperation Attack if attacker is a monster)
C2/15CC: B9 E5 3E     LDA $3EE5,Y
C2/15CF: 89 02        BIT #$02
C2/15D1: F0 3D        BEQ $1610      (No Desperation Attack if attacker is not near fatal)
C2/15D3: 89 24        BIT #$24
C2/15D5: D0 39        BNE $1610      (No Desperation Attack if attacker has Muddled or Image status)
C2/15D7: B9 E4 3E     LDA $3EE4,Y
C2/15DA: 89 12        BIT #$12    
C2/15DC: D0 2B        BNE $1610      (No Desperation Attack if attacker has Clear or Zombie status)
C2/15DE: A5 B9        LDA $B9
C2/15E0: F0 2E        BEQ $1610      (No Desperation Attack if target is not a monster)

;Check Living characters
C2/15E2: AD 76 3A     LDA $3A76         (Check for # of living characters)
C2/15E5: C9 01        CMP #$01         (Is there only 1? In other words, is the attacker the only one standing?)      
C2/15E7: D0 09        BNE $15F2      (If no, branch to probability 1)

;Probability 2
C2/15E9: 20 5A 4B     JSR $4B5A      (Choose a random number between 0 and 255)
C2/15EC: 29 40        CMP #$40       (Is the number > 64?) (3/4 chance of this being yes)
C2/15EE: F0 20        BEQ $1610      (If yes, branch to normal attack.)
C2/15F0: 80 07          BRA $15F9         (Branch to Desperation)

;Probability 1
C2/15F2: 20 5A 4B     JSR $4B5A      (Choose a random number between 0 and 255)
C2/15F5: 29 10        CMP #$10       (Is the number > 16?) (15/16 chance of this being yes)
C2/15F7: F0 17        BEQ $1610      (If yes, branch to normal attack.)

;Queue up Desperation
C2/15F9: 0C 2F 3F     TSB $3F2F      (Check if chraacter has used Desperation. If not, increment up one.)
C2/15FC: D0 12        BNE $1610      (If character has already used a Desperation, branch to normal attack)
C2/15FE: A9 XX          LDA XX         (Queue Up Desperation)
C2/1600: 85 B6          STA $B6         (Save Attack #)
C2/1602: A9 10        LDA #$10
C2/1604: 14 B0        TRB $B0        
C2/1606: 4C 14 17     JMP $1714
C2/1609: EA EA EA       NOP
C2/160C: EA EA          NOP
C2/160E: EA EA          NOP

I also sketched out logic for a much more complex routine, that would choose between a weak and a strong D.A. with different probability based on how many living characters there were. The stats were:
4 living characters: 1 in 32 chance of D.A., no chance of D.A. Lvl 2
3 living characters: 1 in 16 chance of D.A., 10% chance of D.A. Lvl 2
2 living characters: 1 in 8 chance of D.A., 25% chance of D.A. Lvl 2
1 living character: 1 in 4 chance of D.A., 50% chance of D.A. Lvl 2

However, that routine took 27 bytes more than what I had, and I didn't want to jump to another part of C2 to accomplish it. Let me know if you're interested in including that in your hack. The logic obviously hasn't been tested yet. There is room in that logic to add in more levels of D.A. too.


Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
  Find
Quote  



Messages In This Thread
RE: Giving Everyone the Same Desperation Attack - by PowerPanda - 08-05-2018, 10:46 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite