Erwan
- Added a few cards - Creature attacks, blocks, is re-ordered in blocking list events
This commit is contained in:
@@ -140,6 +140,7 @@ public:
|
||||
int resolve(){
|
||||
vector<int>::size_type sz = abilities.size();
|
||||
for (unsigned int i = 0; i < sz; i++){
|
||||
if (target && target!= source && abilities[i]->target == abilities[i]->source) abilities[i]->target = target;
|
||||
abilities[i]->resolve();
|
||||
}
|
||||
return 1;
|
||||
@@ -1734,8 +1735,7 @@ class AStrongLandLinkCreature: public MTGAbility{
|
||||
void Update(float dt){
|
||||
if (source->isAttacker()){
|
||||
if (!game->opponent()->game->inPlay->hasType(land)){
|
||||
source->attacker=0;
|
||||
source->untap();
|
||||
source->toggleAttacker();
|
||||
//TODO Improve, there can be race conditions here
|
||||
}
|
||||
}
|
||||
@@ -2337,7 +2337,8 @@ class AEbonyHorse:public TargetAbility{
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
tc->getNextCardTarget()->attacker = 0;
|
||||
MTGCardInstance * _target = tc->getNextCardTarget();
|
||||
if (_target->isAttacker()) _target->toggleAttacker();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3382,7 +3383,7 @@ class AIslandSanctuary:public MTGAbility{
|
||||
MTGGameZone * zone = game->currentPlayer->game->inPlay;
|
||||
for (int i = 0; i < zone->nb_cards; i++){
|
||||
MTGCardInstance * card = zone->cards[i];
|
||||
if (card->isAttacker() && !card->basicAbilities[Constants::FLYING] && !card->basicAbilities[Constants::ISLANDWALK]) card->attacker=0;
|
||||
if (card->isAttacker() && !card->basicAbilities[Constants::FLYING] && !card->basicAbilities[Constants::ISLANDWALK]) source->toggleAttacker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
void unband();
|
||||
MTGCardInstance * getNextPartner();
|
||||
void initMTGCI();
|
||||
int setDefenser(MTGCardInstance * c);
|
||||
int setAttacker(int value);
|
||||
public:
|
||||
int regenerateTokens;
|
||||
bool isToken;
|
||||
|
||||
@@ -5,6 +5,7 @@ class MTGCardInstance;
|
||||
class MTGGameZone;
|
||||
class Damage;
|
||||
class Phase;
|
||||
class Targetable;
|
||||
|
||||
class WEvent{
|
||||
public:
|
||||
@@ -14,7 +15,7 @@ public:
|
||||
DAMAGE = 2,
|
||||
CHANGE_PHASE = 3,
|
||||
};
|
||||
int type;
|
||||
int type; //Deprecated, use dynamic casting instead
|
||||
WEvent(int _type = NOT_SPECIFIED);
|
||||
virtual ~WEvent() {};
|
||||
};
|
||||
@@ -42,12 +43,54 @@ public:
|
||||
WEventPhaseChange(Phase * _from, Phase * _to);
|
||||
};
|
||||
|
||||
class WEventCardTap: public WEvent{
|
||||
|
||||
//Abstract class of event when a card's status changes
|
||||
class WEventCardUpdate: public WEvent{
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card):WEvent(),card(card){};
|
||||
};
|
||||
|
||||
//Event when a card is tapped/untapped
|
||||
class WEventCardTap: public WEventCardUpdate{
|
||||
public:
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
};
|
||||
|
||||
//Event when a card's "attacker" status changes
|
||||
//before:Player/Planeswalker that card was attacking previously
|
||||
//after: Player/Planeswalker that card is attacking now
|
||||
class WEventCreatureAttacker: public WEventCardUpdate{
|
||||
public:
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card,Targetable * from, Targetable * to);
|
||||
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
class WEventCreatureBlocker: public WEventCardUpdate{
|
||||
public:
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
|
||||
|
||||
};
|
||||
|
||||
//Event when a blocker is reordered
|
||||
//exchangeWith: exchange card's position with exchangeWith's position
|
||||
//attacker:both card and exchangeWith *should* be in attacker's "blockers" list.
|
||||
class WEventCreatureBlockerRank: public WEventCardUpdate{
|
||||
public:
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card,MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user