Fix for issue 962 (Hexproof) by Dmitri

This commit is contained in:
wagic.the.homebrew@gmail.com
2013-09-15 02:57:29 +00:00
parent 7b8189bd13
commit bd25b12fb2
5 changed files with 34 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
# Issue #962: https://code.google.com/p/wagic/issues/detail?id=962&start=100
# Hexproof prevents creature from being counted
#
# Timely reinforcements:
# If you have less life than an opponent, you gain 6 life. If you control fewer creatures than an opponent, put three 1/1 white Soldier creature tokens onto the battlefield.
[INIT]
FIRSTMAIN
[PLAYER1]
manapool:{2}{W}
hand:timely reinforcements
life:19
[PLAYER2]
# creature 1/1, hexproof
inplay:Invisible stalker
[DO]
timely reinforcements
[ASSERT]
FIRSTMAIN
[PLAYER1]
life:25
# 3 tokens
inplay:*,*,*
graveyard:timely reinforcements
manapool:{0}
[PLAYER2]
inplay:Invisible stalker
[END]

View File

@@ -638,6 +638,7 @@ thunder-thrash_elder.txt
tidal_warrior_i646.txt
tidal_warrior_i649.txt
tidal_warrior_i652.txt
Timely_Reinforcements.txt
titanic_ultimatum.txt
torture.txt
tranquil_domain.txt

View File

@@ -36,7 +36,6 @@ public:
TARGETED_PLAYER = 4
};
bool other;
bool withoutProtections;
TargetChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = UNLITMITED_TARGETS, bool other = false, bool targetMin = false);
Player * Owner;
GameObserver *observer;
@@ -48,7 +47,7 @@ public:
bool validTargetsExist(int maxTarget = 1);
int attemptsToFill;
string belongsToAbility;
int countValidTargets();
int countValidTargets(bool withoutProtections = false);
virtual int setAllZones()
{
return 0;

View File

@@ -179,16 +179,16 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
rtc = comparasion[i].substr(foundType + 5, end - foundType - 5).c_str();
TargetChooserFactory tcf(observer);
TargetChooser * ttc = tcf.createTargetChooser(rtc,card);
ttc->withoutProtections = true;
mod = atoi(comparasion[i].substr(end+1).c_str());
bool withoutProtections = true;
if(i == 2)
{
secondAmount = ttc->countValidTargets();
secondAmount = ttc->countValidTargets(withoutProtections);
secondAmount += mod;
}
else
{
firstAmount = ttc->countValidTargets();
firstAmount = ttc->countValidTargets(withoutProtections);
firstAmount += mod;
}

View File

@@ -919,7 +919,7 @@ bool TargetChooser::validTargetsExist(int maxTargets)
return false;
}
int TargetChooser::countValidTargets()
int TargetChooser::countValidTargets(bool withoutProtections)
{
int result = 0;
@@ -943,7 +943,7 @@ int TargetChooser::countValidTargets()
{
for (int j = 0; j < z->nb_cards; j++)
{
if (canTarget(z->cards[j])) result++;
if (canTarget(z->cards[j], withoutProtections)) result++;
}
}
}