diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 9459016d2..111c47de8 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -28204,7 +28204,7 @@ subtype=Equipment [card] name=Executioner's Swing text=Target creature that dealt damage this turn gets -5/-5 until end of turn. -target=creature[damaged] +target=creature[damager] auto=-5/-5 ueot mana={W}{B} type=Instant @@ -104298,4 +104298,4 @@ type=Land Creature subtype=Forest Dryad power=1 toughness=1 -[/card] \ No newline at end of file +[/card] diff --git a/projects/mtg/bin/Res/test/executioners_swing.txt b/projects/mtg/bin/Res/test/executioners_swing.txt new file mode 100644 index 000000000..baabe2c48 --- /dev/null +++ b/projects/mtg/bin/Res/test/executioners_swing.txt @@ -0,0 +1,42 @@ +#NAME: Executioner's Swing +#DESC: Checks targetability +#DESC: Test that can target creature that damaged creature this turn + +[INIT] +combatattackers + +[PLAYER1] +inplay:Grizzly Bears + +[PLAYER2] +inplay:Flying Men,Swamp,Plains +hand:Executioner's Swing + +[DO] +Grizzly Bears +next +Flying Men +next +next +next + +# second main +# kill bear +yes +Swamp +Plains +Executioner's Swing +Grizzly Bears +endinterruption + +[ASSERT] +secondmain + +[PLAYER1] +graveyard:Grizzly Bears + +[PLAYER2] +graveyard:Executioner's Swing,Flying Men +inplay:Plains,Swamp + +[END] diff --git a/projects/mtg/bin/Res/test/executioners_swing2.txt b/projects/mtg/bin/Res/test/executioners_swing2.txt new file mode 100644 index 000000000..cb484e8d7 --- /dev/null +++ b/projects/mtg/bin/Res/test/executioners_swing2.txt @@ -0,0 +1,42 @@ +#NAME: Executioner's Swing +#DESC: Checks targetability +#DESC: Test that can target creature that damaged player + +[INIT] +combatattackers + +[PLAYER1] +inplay:Grizzly Bears + +[PLAYER2] +inplay:Swamp,Plains +hand:Executioner's Swing + +[DO] +Grizzly Bears +next +next +next +next + +# second main +# kill bear +yes +Swamp +Plains +Executioner's Swing +Grizzly Bears +endinterruption + +[ASSERT] +secondmain + +[PLAYER1] +graveyard:Grizzly Bears + +[PLAYER2] +graveyard:Executioner's Swing +inplay:Plains,Swamp +life:18 + +[END] diff --git a/projects/mtg/bin/Res/test/executioners_swing3.txt b/projects/mtg/bin/Res/test/executioners_swing3.txt new file mode 100644 index 000000000..433164fed --- /dev/null +++ b/projects/mtg/bin/Res/test/executioners_swing3.txt @@ -0,0 +1,34 @@ +#NAME: Executioner's Swing +#DESC: Checks targetability +#DESC: Prove that can't target passive creature + +[INIT] +secondmain + +[PLAYER1] +inplay:Grizzly Bears + +[PLAYER2] +manapool:{B}{W} +hand:Executioner's Swing + +[DO] +# attempt to kill bear +yes +Swamp +Plains +Executioner's Swing +Grizzly Bears +endinterruption + +[ASSERT] +secondmain + +[PLAYER1] +inplay:Grizzly Bears + +[PLAYER2] +hand:Executioner's Swing +manapool:{W}{B} + +[END] diff --git a/projects/mtg/include/CardDescriptor.h b/projects/mtg/include/CardDescriptor.h index 704e3d55f..fbe58f4db 100644 --- a/projects/mtg/include/CardDescriptor.h +++ b/projects/mtg/include/CardDescriptor.h @@ -64,6 +64,7 @@ class CardDescriptor: public MTGCardInstance string compareName; int CDopponentDamaged; int CDcontrollerDamaged; + int CDdamager; }; #endif diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index ab708e5db..82053bcf1 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -65,6 +65,7 @@ public: bool wasDealtDamage; bool damageToOpponent; bool damageToController; + bool damageToCreature; bool mPropertiesChangedSinceLastUpdate; int reduxamount; int flanked; diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index f304e356d..789ea16da 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -23,6 +23,7 @@ CardDescriptor::CardDescriptor() colorComparisonMode = COMPARISON_NONE; CDopponentDamaged = 0; CDcontrollerDamaged = 0; + CDdamager = 0; } int CardDescriptor::init() @@ -226,6 +227,13 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) { match = NULL; } + + if ((CDdamager == -1 && (card->damageToOpponent || card->damageToController || card->damageToCreature)) + || (CDdamager == 1 && !(card->damageToOpponent || card->damageToController || card->damageToCreature))) + { + match = NULL; + } + if(CDopponentDamaged == -1 || CDopponentDamaged == 1) { Player * p = card->controller()->opponent();//controller()->opponent(); diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 859a6d936..0b5b9d44a 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1224,6 +1224,18 @@ bool CardGui::FilterCard(MTGCard * _card,string filter) cd.CDcontrollerDamaged = 1; } } + //creature dealt damage to anything + else if (attribute.find("damager") != string::npos) + { + if (minus) + { + cd.CDdamager = -1; + } + else + { + cd.CDdamager = 1; + } + } else if (attribute.find("multicolor") != string::npos) { //card is multicolored? diff --git a/projects/mtg/src/Damage.cpp b/projects/mtg/src/Damage.cpp index 394294ad9..6626c4df8 100644 --- a/projects/mtg/src/Damage.cpp +++ b/projects/mtg/src/Damage.cpp @@ -192,8 +192,10 @@ int Damage::resolve() //return the left over amount after effects have been applied to them. a = target->dealDamage(damage); target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount - if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) + if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){ ((MTGCardInstance*)target)->wasDealtDamage = true; + ((MTGCardInstance*)source)->damageToCreature = true; + } if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER) { if(target == source->controller()) diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index ed01c26d5..80fb9a0f4 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -795,6 +795,7 @@ void GameObserver::gameStateBasedEffects() c->wasDealtDamage = false; c->damageToController = false; c->damageToOpponent = false; + c->damageToCreature = false; c->isAttacking = NULL; } for (int t = 0; t < nbcards; t++) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index e70320ae4..b957afa0c 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -158,6 +158,7 @@ void MTGCardInstance::initMTGCI() auras = 0; damageToOpponent = false; damageToController = false; + damageToCreature = false; wasDealtDamage = false; isDualWielding = false; suspended = false; diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 2e73f23e4..e69f29702 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -485,6 +485,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta cd->CDcontrollerDamaged = 1; } } + //creature dealt damage to anything + else if (attribute.find("damager") != string::npos) + { + if (minus) + { + cd->CDdamager = -1; + } + else + { + cd->CDdamager = 1; + } + } else if (attribute.find("multicolor") != string::npos) { //card is multicolored?