Erwan
- Added deathtouch (TODO: update Combat rules for damage on multiple blockers) - Added intimidate (untested)
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -51,6 +51,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"doesnotuntap",
|
||||
"opponentshroud",
|
||||
"indestructible",
|
||||
"intimidate",
|
||||
"deathtouch"
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user