Fixed bug with preventing Melira from putting +1/+1 counters on creatures you control
This commit is contained in:
@@ -233,6 +233,7 @@ control_magic3.txt
|
||||
control_magic4.txt
|
||||
corrupt.txt
|
||||
counsel_of_the_soratami.txt
|
||||
countershroud.txt
|
||||
counterspell.txt
|
||||
counterspell2.txt
|
||||
counterspell3.txt
|
||||
|
||||
36
projects/mtg/bin/Res/test/countershroud.txt
Normal file
36
projects/mtg/bin/Res/test/countershroud.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
# Testing Melira, Sylvok Outcast (keyword "countershroud")
|
||||
|
||||
# Melira, Sylvok Outcast
|
||||
# id=194274
|
||||
# 2/2
|
||||
# You can't get poison counters. Creatures you control can't have -1/-1 counters placed on them. Creatures your opponents control lose infect.
|
||||
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:194274,grizzly bears,Gavony Township
|
||||
manapool:{2}{W}{G}
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
Gavony Township
|
||||
choice 1
|
||||
next
|
||||
#combatbegins
|
||||
next
|
||||
#attackers
|
||||
194274
|
||||
grizzly bears
|
||||
next
|
||||
#blockers
|
||||
next
|
||||
#combatdamage
|
||||
next
|
||||
#combatend
|
||||
[ASSERT]
|
||||
COMBATEND
|
||||
[PLAYER1]
|
||||
inplay:194274,grizzly bears,Gavony Township
|
||||
manapool:{0}
|
||||
[PLAYER2]
|
||||
life:14
|
||||
[END]
|
||||
@@ -42,13 +42,15 @@ protected:
|
||||
MTGAbility * source;
|
||||
MTGCardInstance * cardSource;
|
||||
MTGCardInstance * cardTarget;
|
||||
TargetChooser * TargetingCards;
|
||||
TargetChooser * tc;
|
||||
Counter * counter;
|
||||
public:
|
||||
RECountersPrevention(MTGAbility * _source,MTGCardInstance * cardSource = NULL,MTGCardInstance * cardTarget = NULL,TargetChooser * tc = NULL,Counter * counter = NULL);
|
||||
RECountersPrevention(MTGAbility * _source, MTGCardInstance * cardSource = NULL,
|
||||
MTGCardInstance * cardTarget = NULL, TargetChooser * tc = NULL, Counter * counter = NULL);
|
||||
WEvent * replace(WEvent *e);
|
||||
~RECountersPrevention();
|
||||
};
|
||||
|
||||
class REDrawReplacement: public ReplacementEffect
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -49,33 +49,36 @@ REDamagePrevention::~REDamagePrevention()
|
||||
SAFE_DELETE(tcTarget);
|
||||
}
|
||||
//counters replacement effect///////////////////
|
||||
RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance * cardSource,MTGCardInstance * cardTarget,TargetChooser * tc,Counter * counter) :
|
||||
source(source),cardSource(cardSource),cardTarget(cardTarget),TargetingCards(tc),counter(counter)
|
||||
RECountersPrevention::RECountersPrevention(MTGAbility * source, MTGCardInstance * cardSource,
|
||||
MTGCardInstance * cardTarget, TargetChooser * tc, Counter * counter) :
|
||||
source(source), cardSource(cardSource), cardTarget(cardTarget), tc(tc), counter(counter)
|
||||
{
|
||||
}
|
||||
|
||||
WEvent * RECountersPrevention::replace(WEvent *event)
|
||||
WEvent * RECountersPrevention::replace(WEvent *event)
|
||||
{
|
||||
if (!event) return event;
|
||||
WEventCounters * e = dynamic_cast<WEventCounters*> (event);
|
||||
if (!e) return event;
|
||||
MTGCardInstance * target = e->targetCard;
|
||||
if (target)
|
||||
{
|
||||
if (!event) return event;
|
||||
WEventCounters * e = dynamic_cast<WEventCounters*> (event);
|
||||
if (!e) return event;
|
||||
if((MTGCardInstance*)e->targetCard)
|
||||
if (target == cardSource || (tc && tc->canTarget(target)))
|
||||
{
|
||||
if((MTGCardInstance*)e->targetCard == cardSource && counter)
|
||||
{
|
||||
if(e->power == counter->power && e->toughness == counter->toughness && e->name == counter->name)
|
||||
return event = NULL;
|
||||
}
|
||||
else if((MTGCardInstance*)e->targetCard == cardSource)
|
||||
return event = NULL;
|
||||
else if(TargetingCards && TargetingCards->canTarget((MTGCardInstance*)e->targetCard))
|
||||
return event = NULL;
|
||||
// counter == NULL means "any counter"
|
||||
if (!counter)
|
||||
return NULL;
|
||||
|
||||
if (e->power == counter->power && e->toughness == counter->toughness && e->name == counter->name)
|
||||
return NULL;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
RECountersPrevention::~RECountersPrevention()
|
||||
{
|
||||
SAFE_DELETE(TargetingCards);
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
////--draw replacement---------------------
|
||||
REDrawReplacement::REDrawReplacement(MTGAbility * source, Player * Drawer, MTGAbility * replaceWith) :
|
||||
|
||||
Reference in New Issue
Block a user