diff --git a/projects/mtg/bin/Res/sets/CFX/_cards.dat b/projects/mtg/bin/Res/sets/CFX/_cards.dat index 9b53a6884..3090aaca4 100644 --- a/projects/mtg/bin/Res/sets/CFX/_cards.dat +++ b/projects/mtg/bin/Res/sets/CFX/_cards.dat @@ -612,6 +612,18 @@ subtype=Elemental Shapeshifter toughness=4 [/card] [card] +text=Toxic Iguanar has deathtouch as long as you control a green permanent. (Whenever it deals damage to a creature, destroy that creature.) +id=170956 +name=Toxic Iguanar +auto=aslongas(*[green]|mybattlefield) deathtouch +rarity=C +type=Creature +mana={R} +power=1 +subtype=Lizard +toughness=1 +[/card] +[card] text=When Tukatongue Thallid is put into a graveyard from play, put a 1/1 green Saproling creature token into play. auto=@movedTo(this|graveyard):token(Saproling,creature Saproling,1/1,green) id=184995 diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index c6ed602cb..3563e4425 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -2,8 +2,7 @@ #Generic engine features ######################## generic/attacks_each_turn.txt -generic/m10_blockers.txt -generic/m10_blockers2.txt +generic/deathtouch.txt generic/first_strike.txt generic/first_strike2.txt generic/first_strike3.txt @@ -12,6 +11,8 @@ generic/hybrid_mana_2.txt generic/hybrid_mana_3.txt generic/legendary.txt generic/lifelink.txt +generic/m10_blockers.txt +generic/m10_blockers2.txt generic/persist.txt generic/persist2.txt generic/persist3.txt diff --git a/projects/mtg/bin/Res/test/generic/deathtouch.txt b/projects/mtg/bin/Res/test/generic/deathtouch.txt new file mode 100644 index 000000000..5623768c3 --- /dev/null +++ b/projects/mtg/bin/Res/test/generic/deathtouch.txt @@ -0,0 +1,23 @@ +#Testing Deathtouch +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:Toxic Iguanar,grizzly bears +[PLAYER2] +inplay:wall of fire +[DO] +Toxic Iguanar +next +#blockers +wall of fire +next +#damage +next +#combat end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:Toxic Iguanar,grizzly bears +[PLAYER2] +graveyard:wall of fire +[END] \ No newline at end of file diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index de6232ccb..d4196afe7 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -95,11 +95,13 @@ class Constants CANTATTACK = 37, MUSTATTACK = 38, CANTBLOCK = 39, - DOESNOTUNTAP =40, - OPPONENTSHROUD=41, - INDESTRUCTIBLE=42, + DOESNOTUNTAP = 40, + OPPONENTSHROUD = 41, + INDESTRUCTIBLE = 42, + INTIMIDATE = 43, + DEATHTOUCH = 44, - NB_BASIC_ABILITIES = 43, + NB_BASIC_ABILITIES = 45, RARITY_M = 'M', diff --git a/projects/mtg/include/MTGRules.h b/projects/mtg/include/MTGRules.h index d03a54396..a4dc31f02 100644 --- a/projects/mtg/include/MTGRules.h +++ b/projects/mtg/include/MTGRules.h @@ -112,6 +112,19 @@ class MTGLifelinkRule:public MTGAbility{ virtual MTGLifelinkRule * clone() const; }; +/* Deathtouch */ +class MTGDeathtouchRule:public MTGAbility{ + public: + MTGDeathtouchRule(int _id); + + int receiveEvent(WEvent * event); + + int testDestroy(); + const char * getMenuText(){return "Deathtouch";} + + virtual MTGDeathtouchRule * clone() const; +}; + /* HUD Display */ diff --git a/projects/mtg/src/DuelLayers.cpp b/projects/mtg/src/DuelLayers.cpp index a631e97d7..da5beba19 100644 --- a/projects/mtg/src/DuelLayers.cpp +++ b/projects/mtg/src/DuelLayers.cpp @@ -26,6 +26,7 @@ void DuelLayers::init(){ action->Add(NEW MTGLegendRule(-1)); action->Add(NEW MTGPersistRule(-1)); action->Add(NEW MTGLifelinkRule(-1)); + action->Add(NEW MTGDeathtouchRule(-1)); //Other display elements action->Add(NEW HUDDisplay(-1)); diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index a496e241e..0e67e2e14 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -343,6 +343,19 @@ int MTGCardInstance::canBlock(MTGCardInstance * opponent){ if (opponent->protectedAgainst(this)) return 0; if (opponent->basicAbilities[Constants::UNBLOCKABLE]) return 0; if (opponent->basicAbilities[Constants::FEAR] && !(hasColor(Constants::MTG_COLOR_ARTIFACT) || hasColor(Constants::MTG_COLOR_BLACK))) return 0; + + //intimidate + if (opponent->basicAbilities[Constants::INTIMIDATE] && !(hasColor(Constants::MTG_COLOR_ARTIFACT))){ + int canblock = 0; + for (int i = Constants::PROTECTIONGREEN; i <= Constants::PROTECTIONWHITE; ++i){ + if(hasColor(i) && opponent->hasColor(i)){ + canblock = 1; + break; + } + } + if (!canblock) return 0; + } + if (opponent->basicAbilities[Constants::FLYING] && !( basicAbilities[Constants::FLYING] || basicAbilities[Constants::REACH])) return 0; //Can block only creatures with flying if has cloud if (basicAbilities[Constants::CLOUD] && !( opponent->basicAbilities[Constants::FLYING])) return 0; diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index d9a88f2de..64888b754 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -51,6 +51,8 @@ const char* Constants::MTGBasicAbilities[] = { "doesnotuntap", "opponentshroud", "indestructible", +"intimidate", +"deathtouch" }; diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index b8dbf2532..eae3f673e 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -169,6 +169,8 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card){ return 1; } + + //The Block rule is never destroyed int MTGBlockRule::testDestroy(){ return 0; @@ -526,3 +528,38 @@ HUDDisplay::~HUDDisplay(){ a->isClone = 1; return a; } + + + /* Deathtouch */ + MTGDeathtouchRule::MTGDeathtouchRule(int _id):MTGAbility(_id,NULL){}; + + int MTGDeathtouchRule::receiveEvent(WEvent * event){ + if (event->type == WEvent::DAMAGE){ + WEventDamage * e = (WEventDamage *) event; + + Damage * d = e->damage; + if (d->damage <= 0) return 0; + + MTGCardInstance * card = d->source; + if (!card) return 0; + + if (d->target->type_as_damageable != DAMAGEABLE_MTGCARDINSTANCE) return 0; + MTGCardInstance * _target = (MTGCardInstance *) (d->target); + + if (card->basicAbilities[Constants::DEATHTOUCH]){ + _target->destroy(); + return 1; + } + } + return 0; + } + + int MTGDeathtouchRule::testDestroy(){return 0;} + + + MTGDeathtouchRule * MTGDeathtouchRule::clone() const{ + MTGDeathtouchRule * a = NEW MTGDeathtouchRule(*this); + a->isClone = 1; + return a; + } +