Fix for issue 962 (Hexproof) by Dmitri
This commit is contained in:
@@ -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]
|
||||||
@@ -638,6 +638,7 @@ thunder-thrash_elder.txt
|
|||||||
tidal_warrior_i646.txt
|
tidal_warrior_i646.txt
|
||||||
tidal_warrior_i649.txt
|
tidal_warrior_i649.txt
|
||||||
tidal_warrior_i652.txt
|
tidal_warrior_i652.txt
|
||||||
|
Timely_Reinforcements.txt
|
||||||
titanic_ultimatum.txt
|
titanic_ultimatum.txt
|
||||||
torture.txt
|
torture.txt
|
||||||
tranquil_domain.txt
|
tranquil_domain.txt
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public:
|
|||||||
TARGETED_PLAYER = 4
|
TARGETED_PLAYER = 4
|
||||||
};
|
};
|
||||||
bool other;
|
bool other;
|
||||||
bool withoutProtections;
|
|
||||||
TargetChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = UNLITMITED_TARGETS, bool other = false, bool targetMin = false);
|
TargetChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = UNLITMITED_TARGETS, bool other = false, bool targetMin = false);
|
||||||
Player * Owner;
|
Player * Owner;
|
||||||
GameObserver *observer;
|
GameObserver *observer;
|
||||||
@@ -48,7 +47,7 @@ public:
|
|||||||
bool validTargetsExist(int maxTarget = 1);
|
bool validTargetsExist(int maxTarget = 1);
|
||||||
int attemptsToFill;
|
int attemptsToFill;
|
||||||
string belongsToAbility;
|
string belongsToAbility;
|
||||||
int countValidTargets();
|
int countValidTargets(bool withoutProtections = false);
|
||||||
virtual int setAllZones()
|
virtual int setAllZones()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -179,16 +179,16 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
|||||||
rtc = comparasion[i].substr(foundType + 5, end - foundType - 5).c_str();
|
rtc = comparasion[i].substr(foundType + 5, end - foundType - 5).c_str();
|
||||||
TargetChooserFactory tcf(observer);
|
TargetChooserFactory tcf(observer);
|
||||||
TargetChooser * ttc = tcf.createTargetChooser(rtc,card);
|
TargetChooser * ttc = tcf.createTargetChooser(rtc,card);
|
||||||
ttc->withoutProtections = true;
|
|
||||||
mod = atoi(comparasion[i].substr(end+1).c_str());
|
mod = atoi(comparasion[i].substr(end+1).c_str());
|
||||||
|
bool withoutProtections = true;
|
||||||
if(i == 2)
|
if(i == 2)
|
||||||
{
|
{
|
||||||
secondAmount = ttc->countValidTargets();
|
secondAmount = ttc->countValidTargets(withoutProtections);
|
||||||
secondAmount += mod;
|
secondAmount += mod;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
firstAmount = ttc->countValidTargets();
|
firstAmount = ttc->countValidTargets(withoutProtections);
|
||||||
firstAmount += mod;
|
firstAmount += mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -919,7 +919,7 @@ bool TargetChooser::validTargetsExist(int maxTargets)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TargetChooser::countValidTargets()
|
int TargetChooser::countValidTargets(bool withoutProtections)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
@@ -943,7 +943,7 @@ int TargetChooser::countValidTargets()
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < z->nb_cards; j++)
|
for (int j = 0; j < z->nb_cards; j++)
|
||||||
{
|
{
|
||||||
if (canTarget(z->cards[j])) result++;
|
if (canTarget(z->cards[j], withoutProtections)) result++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user