damage/combat damage events
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
3 posts
• Page 1 of 1
damage/combat damage events
by mtgrares » 12 Feb 2010, 19:05
I don't know would it be possible to add the methods below. (I don't mind doing the work but I'm just trying to figure out it is possible.)
GameAction has
I know Forge does not have many "central points of control" and that is why Dennis had to re-write all of the targeting code to implement protection.
Just a few random thoughts. It is hard to know which thoughts are valuable and which one aren't. I just saw a History Detectives about Thomas Edison trying to build houses out of concrete, ha.
- Code: Select all
combatDamage(int nDamage, Card damageTo, Card damageFrom)
combatDamage(int nDamage, String player, Card damageFrom)
damage(int nDamage, String player, Card damageFrom)
damage(int nDamage, Card damageTo, Card damageFrom)
- Code: Select all
Card class
public void addDamage(int n, Card source)
{
...misc stuff for Cho-Manno, Revolutionary
if (CardFactoryUtil.canDamage(source, this))
{
AllZone.GameAction.damage(n, this, source);
}
}

GameAction has
- Code: Select all
addDamage(Card card, Card source, int damage)
addDamage(Card card, HashMap<Card,Integer> map)
addLife(String player, int life)
subLife(String player, int life)
addDamage(String player, int damage)
I know Forge does not have many "central points of control" and that is why Dennis had to re-write all of the targeting code to implement protection.
Just a few random thoughts. It is hard to know which thoughts are valuable and which one aren't. I just saw a History Detectives about Thomas Edison trying to build houses out of concrete, ha.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: damage/combat damage events
by Rob Cashwalker » 13 Feb 2010, 03:03
GameAction.addDamage is what most damage dealing effects SHOULD use. It's getting rather full, and I'm not sure how GameAction was intended to be used. It looked like it was a central repository for the player-neutral processing of the various standard effects - discard, damage, draw, life modification, etc. So, we've added a number of methods to GameAction that do basically the same thing, but with different inputs.
While I revised the abDamageCP code, I found that it was checking for lifelink effects, and three card-specific interactions and deathtouch. GameAction.addDamage had similar checks, but one was missing, I don't recall which one.
Basically, the goal should be to keep it all in one place for just this reason, so that if there absolutely must be hard-coded card interaction, that it's coded in one place, so that it affects all effects equally.
If GameAction was not intended to be such a repository, then by all means let's hammer out a plan for such a new class.
And yeah, combatDamage, directDamage and "anyDamage" need to be aggregated somehow. One of the card-specific interactions I had found implemented wrong, was Mirri, (the Cursed? I don't recall, I posted it in the bug thread, but that might've been before the hiccup) Mirri triggers off combat damage only, while the other card it was in an if-block for was any type of damage.
While I revised the abDamageCP code, I found that it was checking for lifelink effects, and three card-specific interactions and deathtouch. GameAction.addDamage had similar checks, but one was missing, I don't recall which one.
Basically, the goal should be to keep it all in one place for just this reason, so that if there absolutely must be hard-coded card interaction, that it's coded in one place, so that it affects all effects equally.
If GameAction was not intended to be such a repository, then by all means let's hammer out a plan for such a new class.
And yeah, combatDamage, directDamage and "anyDamage" need to be aggregated somehow. One of the card-specific interactions I had found implemented wrong, was Mirri, (the Cursed? I don't recall, I posted it in the bug thread, but that might've been before the hiccup) Mirri triggers off combat damage only, while the other card it was in an if-block for was any type of damage.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: damage/combat damage events
by mtgrares » 19 Feb 2010, 19:38
GameAction is a good place to put new methods, even though it might get crowed/complicated. At first GameAction just did basic stuff like draw a card but it seemed like a good place to put more complicated stuff like dealing damage and checking for state effects.
You (and Dennis, Chris, SillyFreak) have done a really good job grafting in new stuff.
You (and Dennis, Chris, SillyFreak) have done a really good job grafting in new stuff.

- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 35 guests