It is currently 17 Jun 2025, 22:48
   
Text Size

enPump keyword

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: enPump keyword

Postby Chris H. » 05 Apr 2010, 23:35

With a few lines of code I was able to create a second SpellAbility named enPumpCurse_Enchant and the AI located inside will target the Human creatures instead of the computer. I add "Curse" to the keyword in cards.txt and get this card for example:

    Feebleness
    1 B
    Enchantment Aura
    Enchanted creature gets -2/-1.
    Flash
    Enchant creature
    enPumpCurse:-2/-1

The enPump keyword code at the end of CardFactory_Auras.java tests to see if k[0].contains("Curse") and sets a boolean. Depending on the value of the boolean, the code will

Code: Select all
card.addSpellAbility(CardFactoryUtil.enPump_Enchant();
`
or

Code: Select all
card.addSpellAbility(CardFactoryUtil.enPumpCurse_Enchant();
`
and the appropriate SpellAbility will be called. So far I like what I see.

Except, the computer correctly cast the Feebleness spell on MY Ornothopter and it's net power/toughness becomes -2/1. I attacked for the heck of it, the Ornothopter was not blocked and the computer gained 2 life. :shock:
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby Chris H. » 06 Apr 2010, 12:14

There are two hard coded auras that reduce the power of the enchanted creature. These cards are Despondency and Weakness. I had 3 Despondency cast on my Ornothopter and I then attacked as a -6/2 creature. The computer gained 6 life. The same thing happens with Weakness and with Char Rambler.

Is this a rules compliant interpretation?

I plan to commit my enPump[Curse] code and will add and convert additional cards. If the situation above is not rules compliant … well, I imagine that it would have to be handled somewhere in the combat code.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby silly freak » 06 Apr 2010, 12:28

it's not...

107.1 The only numbers the Magic game uses are integers.

Example: If a 3/4 creature gets -5/-0, it's a -2/4 creature. It assigns 0 damage in combat. Its total power and toughness is 2. You'd have to give it +3/+0 to raise its power to 1.

Example: Viridian Joiner is a 1/2 creature that says "{T}: Add an amount of {G} to your mana pool equal to Viridian Joiner's power." An effect gives it -2/-0, then its ability is activated. The ability adds no mana to your mana pool.
combat or damage is likely the right place for it
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: enPump keyword

Postby DennisBergkamp » 06 Apr 2010, 16:00

Yeah, I'll fix it (I thought this was fixed already, but guess not).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: enPump keyword

Postby Chris H. » 06 Apr 2010, 16:10

DennisBergkamp wrote:Yeah, I'll fix it (I thought this was fixed already, but guess not).
`
Thank you, this will allow me to add another half dozen auras or so. 8)
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby DennisBergkamp » 06 Apr 2010, 16:46

It should be fixed now in the latest SVN (tested with Char-Rumbler, computer did not gain any life when attacked).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: enPump keyword

Postby Chris H. » 07 Apr 2010, 23:01

I uploaded another version. The format at this time is:

enPump[Curse]:[p/t][/][k1 & k2 ... kn][:spellDescription][:stackDescription]

power/toughness and keywords are optional, although you must have at least one of these two.

multiple keywords are separated by the "&" character.

spellDescription and stackDescription are optional.

The card description must be included in the 4th line of the cards.txt entry. The code will build these descriptions and these descriptions will be replaced by any descriptions that are included with the keyword.

The enPumpCurse variant causes the AI to cast the aura on the opponent's creature rather than it's own.

The AI will cast the enPump variant aura on it's own Rabid Wombat or Uril, the Miststalker rather than another creature if it has at least one of these on the battlefield.

The computer will not cast an aura on it's own creature if this will cause the creature's power or toughness to fall to zero or less.

Keyword'ed auras at this time are compatible with Flash and Cycling.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby mullery » 13 Sep 2010, 17:28

Hello,

Would it be possible to implement the support of +X/+X to enPump in the same manner than in abPump ?
mullery
 
Posts: 8
Joined: 05 Aug 2010, 20:13
Has thanked: 0 time
Been thanked: 0 time

Re: enPump keyword

Postby Chris H. » 13 Sep 2010, 18:20

mullery wrote:Hello,

Would it be possible to implement the support of +X/+X to enPump in the same manner than in abPump ?
`
Do you mean in the sense of having auras like Firebreathing?
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby friarsol » 13 Sep 2010, 18:35

I took it to mean cards like Empyrial Armor. But some clarification of what cards this represents should help.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: enPump keyword

Postby Chris H. » 13 Sep 2010, 18:44

friarisol wrote:I took it to mean cards like Empyrial Armor. But some clarification of what cards this represents should help.
`
Yeah, a clarification would help. :D
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby Rob Cashwalker » 13 Sep 2010, 18:58

Yeah, I think he means cases where X is a calculated value, using xCount and possibly doXMath.
There's plenty of example of how to apply it in spPump and abPump.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: enPump keyword

Postby Chris H. » 13 Sep 2010, 22:47

It should not be too hard to add xCount and doXMath to the enPump keyword. Mullery can take a shot at it if he an interest in adding to the enPump keyword. :D
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: enPump keyword

Postby mullery » 14 Sep 2010, 06:09

Hi, in fact I'd just want to add the card Armored Ascension, so I have to be able to count the number of Plains the player controls. I think I just have to copy/paste the right paragraphe from the code which manage the abPump keyword.

I'll try to code it as soon as I get commit right.

Regards,
mullery.
mullery
 
Posts: 8
Joined: 05 Aug 2010, 20:13
Has thanked: 0 time
Been thanked: 0 time

Re: enPump keyword

Postby Chris H. » 14 Sep 2010, 13:06

mullery wrote:Hi, in fact I'd just want to add the card Armored Ascension, so I have to be able to count the number of Plains the player controls. I think I just have to copy/paste the right paragraphe from the code which manage the abPump keyword.

I'll try to code it as soon as I get commit right.
`
Yeah, the easiest way to accomplish this would be to use the existing code as an example. You could first try doing this as a stand-alone card object. Take a look at CardFactory_Auras. I commented out a number of cards as I converted them over to use the enPump keyword. One of these could be used as a starting template.

Once you get it working as a single card object you can then try to modify the enPump keyword to handle the X cost. :wink:
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 33 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 33 users online :: 0 registered, 0 hidden and 33 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 33 guests

Login Form