two addDamage methods?
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
6 posts
• Page 1 of 1
two addDamage methods?
by DennisBergkamp » 06 Sep 2010, 06:18
Is there any reason we have these two addDamage methods in GameAction?
Unless I'm missing something here, I think it should be safe for me to turn these into one single method?
- Code: Select all
public void addDamage(String player, int damage, Card source) {
// place holder for future damage modification rules (prevention?)
if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damage);
CardList cl = CardFactoryUtil.getAurasEnchanting(source, "Guilty Conscience");
for(Card c:cl) {
GameActionUtil.executeGuiltyConscienceEffects(source, c, damage);
}
getPlayerLife(player).subtractLife(damage,source);
}
/**
public void addDamage(String player, int damage) {
// place holder for future damage modification rules (prevention?)
getPlayerLife(player).subtractLife(damage);
}
**/
public void addDamage(String player, Card source, int damage) {
getPlayerLife(player).subtractLife(damage,source);
if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damage);
CardList cl = CardFactoryUtil.getAurasEnchanting(source, "Guilty Conscience");
for(Card c:cl) {
GameActionUtil.executeGuiltyConscienceEffects(source, c, damage);
}
}
Unless I'm missing something here, I think it should be safe for me to turn these into one single method?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: two addDamage methods?
by DennisBergkamp » 06 Sep 2010, 07:46
Never mind, it was obvious this second method was unnecessary. I got rid of it and made a bunch of other changes that should increase flexibility of the damage code. Might even allow for coding some new cards 
By the way, I couldn't resist and started adding some of the new spoiled cards... cool thing is, that all of the new stuff seems to be very doable in Forge (Proliferate, Infect, Emblems, Metalcraft), even both Planeswalkers look like a piece of cake.

By the way, I couldn't resist and started adding some of the new spoiled cards... cool thing is, that all of the new stuff seems to be very doable in Forge (Proliferate, Infect, Emblems, Metalcraft), even both Planeswalkers look like a piece of cake.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: two addDamage methods?
by Sloth » 09 Sep 2010, 07:30
Did you implement the new keyword Infect to also work with non-combat damage, because Wither and "Whenever a creature dealt damage by CARDNAME this turn is put into a graveyard, put a +1/+1 counter on CARDNAME." do not.DennisBergkamp wrote:By the way, I couldn't resist and started adding some of the new spoiled cards... cool thing is, that all of the new stuff seems to be very doable in Forge (Proliferate, Infect, Emblems, Metalcraft), even both Planeswalkers look like a piece of cake.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: two addDamage methods?
by DennisBergkamp » 09 Sep 2010, 17:34
Yes, I'm pretty sure Infect also works for ping-effects... but so should Wither, if I'm not mistaken.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: two addDamage methods?
by Sloth » 09 Sep 2010, 19:03
You're right Wither works for pingers (I tested with Pestilence Demon were it did not work, but this should be a problem of the Demon, not with Wither).DennisBergkamp wrote:Yes, I'm pretty sure Infect also works for ping-effects... but so should Wither, if I'm not mistaken.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 54 guests