Users browsing this thread: 1 Guest(s)
Turning Runic into Cover

#11
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
Ok, I think I've got this where I like it. Required making a new ability effect. I used x05 and some free space in the C1 bank to write it. Here's the code if anyone is interested.

First, the actual menu action, which replaces Runic:
Code:
Cover (Replaces Runic)
C2/195B: BB           TYX
C2/195C: 20 8A 29     JSR $298A   (Clear special effect, magic power, etc.)
C2/195F: A9 0A        LDA #$0A    (2x05)
C2/1961: 8D A9 11     STA $11A9   (Stores Cover in special effect)
C2/1964: 4C 7B 31     JMP $317B
You see that JMP at the end? that's where I was having trouble with targetting. Runic uses $3167, which is used only for abilities that ignore targetting altogether. Kinda embarraced I missed that.

Next is the new ability effect to set up Covering an ally:
Code:
Cover effect 0x05 (0A)

C2/6473: A3 05        LDA $05,S
C2/6475: AA           TAX
C2/6476: 5A              PHY
C2/6477: A0 00          LDY #$00
C2/6479: 8A              TXA
C2/647A: D9 6C 33      CMP $336C,Y  (Is this character protected by attacker?)
C2/647D: D0 05          BNE $6484    (Branch if not)
C2/647F: A9 FF          LDA #$FF
C2/6481: 99 6C 33      STA $336C,Y  (Clear who takes damage for this person)
C2/6484: C8              INY
C2/6485: C8              INY
C2/6486: C0 12          CPY #$14     (Have we checked all characters)
C2/6488: 90 EF          BCC $6479    (Branch if not)
C2/648A: 7A              PLY
C2/648B: 98           TYA
C2/648C: 9D 6D 33     STA $336D,X  (Attacker data: save who they're taking damage for)
C2/648F: 8A           TXA
C2/6490: DD 6D 33     CMP $336D,X  (are these the same person?)
C2/6493: D0 06          BNE $649B       (Branch if not)
C2/6495: A9 FF          LDA #$FF
C2/6497: 9D 6D 33      STA $336D,X  (Attacker data: no longer takes damage for anyone)
C2/649A: 60              RTS
C2/649B: 99 6C 33      STA $336C,Y  (Target data: save who takes damage for them)
C2/649E: 60           RTS
Took me a while to get the logic right without making the code any longer than it needed to be. Essentially I need to clear the old effect before a new one can be applied. I couldn't directly compare A with X or Y so I had to store the new defendee in order to check to see if they were the same person, otherwise the cover effect would apply to himself/herself, causing the character to jump out of place to take their own blows. One little note here, since I am using the Love Token mechanic to make this work, Using cover clears any love token effect on the Cover user, not just ones set up by Cover.

And last, but not least... I had to put the new code in the pointer list for ability effects:
Code:
Table for special effects code pointers 1

C2/3DCD: 8C 38
C2/3DCF: 8C 38
C2/3DD1: 8C 38
C2/3DD3: 43 3D ($03)
C2/3DD5: F2 38 ($04)
C2/3DD7: 73 64 ($05) (Cover!)

So there it is. I'm trying to decide if I want Cover to last until pointed somewhere else, or if I want it to end after X number of turns... it just means more coding and finding an unused variable, which I don't much feel like doing, but we will see how it plays out in practical use.

Feel free to use this code, with how short the code for the menu ability is, you can replace anything you want (in the event you really want to keep Runic). Let me know what you think!
  Find
Quote  
[-] The following 2 users say Thank You to B-Run for this post:
  • C-Dude (09-12-2019), Timbo (04-21-2017)



Messages In This Thread
Turning Runic into Cover - by B-Run - 07-20-2012, 05:19 PM
RE: Turning Runic into Cover - by Gi Nattak - 07-21-2012, 02:31 PM
RE: Turning Runic into Cover - by SSJ Rick - 07-21-2012, 03:34 PM
RE: Turning Runic into Cover - by Sutebenukun - 07-21-2012, 04:21 PM
RE: Turning Runic into Cover - by madsiur - 07-21-2012, 06:05 PM
RE: Turning Runic into Cover - by B-Run - 07-22-2012, 07:00 PM
RE: Turning Runic into Cover - by madsiur - 07-24-2012, 08:50 PM
RE: Turning Runic into Cover - by B-Run - 07-24-2012, 11:19 PM
RE: Turning Runic into Cover - by B-Run - 07-26-2012, 08:07 PM
RE: Turning Runic into Cover - by madsiur - 07-27-2012, 12:29 PM
RE: Turning Runic into Cover - by B-Run - 08-15-2012, 11:47 AM
RE: Turning Runic into Cover - by Catone - 08-15-2012, 01:39 PM
RE: Turning Runic into Cover - by B-Run - 08-15-2012, 01:58 PM
RE: Turning Runic into Cover - by Catone - 08-15-2012, 05:04 PM
RE: Turning Runic into Cover - by B-Run - 08-15-2012, 09:17 PM
RE: Turning Runic into Cover - by Catone - 08-15-2012, 10:06 PM
RE: Turning Runic into Cover - by Timbo - 04-22-2017, 05:13 PM
RE: Turning Runic into Cover - by B-Run - 04-24-2017, 07:30 AM
RE: Turning Runic into Cover - by Timbo - 04-25-2017, 12:24 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite