canPlayFromEffectAI
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
4 posts
• Page 1 of 1
canPlayFromEffectAI
by Sloth » 14 Jan 2012, 10:55
I want to add a new AI function to all AbilityFactories that checks whether a spell should be cast from effects like Cascade and Ripple. Other cards that could make use of it in the future are: Memory Plunder, Omen Machine, Sins of the Past,...
It will normaly just use the trigger AI function. The parameters will be whether it's mandatory (Omen Machine) and whether it's without mana cost.
Any suggestions or warnings?
It will normaly just use the trigger AI function. The parameters will be whether it's mandatory (Omen Machine) and whether it's without mana cost.
Any suggestions or warnings?
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: canPlayFromEffectAI
by friarsol » 14 Jan 2012, 14:27
I would have it check where the card is located too. If it's not in the AIs hand then it's card advantage and should generally be played as long as there is a minor positive effect.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: canPlayFromEffectAI
by Sloth » 14 Jan 2012, 15:34
The number of cards that have these effect on cards in your hand is next to zero and doTrigger generally returns true unless the effect is negative.friarsol wrote:I would have it check where the card is located too. If it's not in the AIs hand then it's card advantage and should generally be played as long as there is a minor positive effect.
First testings showed good results.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: canPlayFromEffectAI
by friarsol » 14 Jan 2012, 21:49
Sloth, I have an infinite loop here:
Edit: I put in a temporary fix. Not sure if this is what it's sposed to do, or if this exists anywhere else.
- Code: Select all
private boolean pumpTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
if (!ComputerUtil.canPayCost(sa)) {
return false;
}
return pumpTriggerAI(af, sa, mandatory);
}
Edit: I put in a temporary fix. Not sure if this is what it's sposed to do, or if this exists anywhere else.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests