Where does equipping logic happen?
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
4 posts
• Page 1 of 1
Where does equipping logic happen?
by mcrawford620 » 07 Aug 2012, 22:07
For an Equipment like Ring of Thune, where is the logic that determines what creature the AI attaches it to?
I looked everywhere I could think of but couldn't find what code was actually doing it.
I looked everywhere I could think of but couldn't find what code was actually doing it.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: Where does equipping logic happen?
by moomarc » 08 Aug 2012, 05:52
The Equip macro is handled in CardFactoryUtil, from line 4652. You probably just need to add a split so that you can specify a preferred AI target in the form of AITgts$ Card.valid, then just append that to the ability string.mcrawford620 wrote:For an Equipment like Ring of Thune, where is the logic that determines what creature the AI attaches it to?
I looked everywhere I could think of but couldn't find what code was actually doing it.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Where does equipping logic happen?
by moomarc » 08 Aug 2012, 07:28
I decided to go ahead and do it myself. The M13 rings are done, but if you come across any other equipment that needs preferred targeting for the AI (or any other additional params, just add the new params after the equip cost. It'll take everything after the first "|" and add it to the generated Attach script. Eg: Ring of Thune now has this:moomarc wrote:The Equip macro is handled in CardFactoryUtil, from line 4652. You probably just need to add a split so that you can specify a preferred AI target in the form of AITgts$ Card.valid, then just append that to the ability string.mcrawford620 wrote:For an Equipment like Ring of Thune, where is the logic that determines what creature the AI attaches it to?
I looked everywhere I could think of but couldn't find what code was actually doing it.
- Code: Select all
K:Equip 1 | AITgts$ Creature.White
- Code: Select all
AB$ Attach | Cost$ 1 | AITgts$ Creature.White | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SorcerySpeed$ True | Equip$ True | AILogic$ Pump | IsPresent$ Card.Self+nonCreature | PrecostDesc$ Equip | SpellDescription$ (Attach to target creature you control. Equip only as a sorcery.)
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Where does equipping logic happen?
by mcrawford620 » 08 Aug 2012, 16:25
I see now, thanks. I didn't understand anything about the CardFactoryUtil and how it generates that script, so it took me forever to figure out that the logic ends up in AbilityFactoryAttach.
Now the AI will never attach the Rings to a different-colored creature. I think that's OK here since the other abilities are pretty tricky to use correctly (Hexproof, Haste). I think the +1/+1 counters are what will actually be useful to the AI.
Now the AI will never attach the Rings to a different-colored creature. I think that's OK here since the other abilities are pretty tricky to use correctly (Hexproof, Haste). I think the +1/+1 counters are what will actually be useful to the AI.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 41 guests