Erwan
- fix issue 143 (exalted should be a triggered ability)
This commit is contained in:
@@ -14,6 +14,8 @@ generic/equip_shroud.txt
|
||||
generic/equip_shroud2.txt
|
||||
generic/equip_wither.txt
|
||||
generic/equipment_i252.txt
|
||||
generic/exalted.txt
|
||||
generic/exalted_i143.txt
|
||||
generic/fear.txt
|
||||
generic/fear_i147.txt
|
||||
generic/first_and_double_strike1_i187.txt
|
||||
|
||||
37
projects/mtg/bin/Res/test/generic/exalted.txt
Normal file
37
projects/mtg/bin/Res/test/generic/exalted.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
#Testing exalted
|
||||
[INIT]
|
||||
COMBATATTACKERS
|
||||
[PLAYER1]
|
||||
inplay:sigiled paladin,grizzly bears
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
grizzly bears
|
||||
eot
|
||||
eot
|
||||
next
|
||||
#upkeep
|
||||
next
|
||||
#draw
|
||||
next
|
||||
#main
|
||||
next
|
||||
#cb begins
|
||||
next
|
||||
#attackers
|
||||
grizzly bears
|
||||
sigiled paladin
|
||||
next
|
||||
#blockers
|
||||
next
|
||||
#damage 1st strike
|
||||
next
|
||||
#damage 2
|
||||
next
|
||||
#combat end
|
||||
[ASSERT]
|
||||
COMBATEND
|
||||
[PLAYER1]
|
||||
inplay:sigiled paladin,grizzly bears
|
||||
[PLAYER2]
|
||||
life:13
|
||||
[END]
|
||||
@@ -10,10 +10,8 @@
|
||||
combatattackers
|
||||
[PLAYER1]
|
||||
inplay:qasali pridemage,outrider of jhess
|
||||
graveyard:
|
||||
[PLAYER2]
|
||||
inplay:white knight
|
||||
graveyard:
|
||||
life:7
|
||||
[DO]
|
||||
qasali pridemage
|
||||
@@ -1554,51 +1554,47 @@ class ARegularLifeModifierAura:public MTGAbility{
|
||||
|
||||
|
||||
//ExaltedAbility (Shards of Alara)
|
||||
class AExalted:public ListMaintainerAbility{
|
||||
class AExalted:public TriggeredAbility{
|
||||
public:
|
||||
int power, toughness;
|
||||
MTGCardInstance * luckyWinner;
|
||||
AExalted(int _id, MTGCardInstance * _source, int _power = 1, int _toughness = 1):ListMaintainerAbility(_id, _source),power(_power),toughness(_toughness){
|
||||
AExalted(int _id, MTGCardInstance * _source, int _power = 1, int _toughness = 1):TriggeredAbility(_id, _source),power(_power),toughness(_toughness){
|
||||
luckyWinner = NULL;
|
||||
}
|
||||
|
||||
int triggerOnEvent(WEvent * event) {
|
||||
if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event)) {
|
||||
if (luckyWinner && Constants::MTG_PHASE_AFTER_EOT == pe->from->id){
|
||||
luckyWinner->addToToughness(-toughness);
|
||||
luckyWinner->power-=power;
|
||||
luckyWinner = NULL;
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (card->isAttacker() && game->currentPlayer == source->controller() && game->isInPlay(card)) return 1;
|
||||
if (Constants::MTG_PHASE_COMBATATTACKERS == pe->from->id) {
|
||||
int nbattackers = 0;
|
||||
MTGGameZone * z = source->controller()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
for (int i = 0; i < nbcards; ++i){
|
||||
MTGCardInstance * c = z->cards[i];
|
||||
if (c->attacker){
|
||||
nbattackers++;
|
||||
luckyWinner = c;
|
||||
}
|
||||
}
|
||||
if (nbattackers == 1) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int added(MTGCardInstance * card){
|
||||
if(cards.size() == 1){
|
||||
luckyWinner = cards.begin()->first;
|
||||
luckyWinner->addToToughness(toughness);
|
||||
luckyWinner->power+=power;
|
||||
}else if (cards.size() == 2){
|
||||
luckyWinner->addToToughness(-toughness);
|
||||
luckyWinner->power-=power;
|
||||
}
|
||||
int resolve(){
|
||||
if (!luckyWinner) return 0;
|
||||
luckyWinner->addToToughness(toughness);
|
||||
luckyWinner->power+=power;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int removed(MTGCardInstance * card){
|
||||
if(cards.size() == 1){
|
||||
luckyWinner = cards.begin()->first;
|
||||
luckyWinner->addToToughness(toughness);
|
||||
luckyWinner->power+=power;
|
||||
}else if (cards.size() == 0){
|
||||
luckyWinner->addToToughness(-toughness);
|
||||
luckyWinner->power-=power;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "AExalted ::: power : " << power
|
||||
<< " ; toughness : " << toughness
|
||||
<< " (";
|
||||
return ListMaintainerAbility::toString(out) << ")";
|
||||
}
|
||||
AExalted * clone() const{
|
||||
AExalted * a = NEW AExalted(*this);
|
||||
a->isClone = 1;
|
||||
@@ -1606,56 +1602,6 @@ class AExalted:public ListMaintainerAbility{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//ExaltedAbility for basic abilities (Shards of Alara)
|
||||
class AExaltedAbility:public ListMaintainerAbility{
|
||||
public:
|
||||
int ability;
|
||||
MTGCardInstance * luckyWinner;
|
||||
AExaltedAbility(int _id, MTGCardInstance * _source, int _ability):ListMaintainerAbility(_id, _source),ability(_ability){
|
||||
luckyWinner = NULL;
|
||||
}
|
||||
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (card->isAttacker() && game->currentPlayer == source->controller() && game->isInPlay(card)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int added(MTGCardInstance * card){
|
||||
luckyWinner = cards.begin()->first;
|
||||
if(cards.size() == 1){
|
||||
luckyWinner->basicAbilities[ability]+=1;
|
||||
}else if (cards.size() == 2){
|
||||
luckyWinner->basicAbilities[ability]-=1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int removed(MTGCardInstance * card){
|
||||
if(cards.size() == 1){
|
||||
luckyWinner->basicAbilities[ability]+=1;
|
||||
}else if (cards.size() == 0){
|
||||
luckyWinner->basicAbilities[ability]-=1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "AExaltedAbility ::: ability : " << ability
|
||||
<< " ; luckyWinner : " << luckyWinner
|
||||
<< " (";
|
||||
return ListMaintainerAbility::toString(out) << ")";
|
||||
}
|
||||
AExaltedAbility * clone() const{
|
||||
AExaltedAbility * a = NEW AExaltedAbility(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Converts lands to creatures (Kormus bell, Living lands)
|
||||
class AConvertLandToCreatures:public ListMaintainerAbility{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user