Files
wagic/projects/mtg/include/WEvent.h
salmelo16 9cf4c7587b added ability to have triggered abilities target based on the event that triggered, bramblewood paragon, graft, etc.
use "trigger" inside target code of triggered ability.
does not work with @each and @next.
@damaged can use trigger[to] and trigger[from] to specify the target or source of the damage, respectively.

Adds cards:
Aether Flash
Bramblewood Paragon
In the Web of War
Juniper Order Ranger
Mortuary
Primal Forcemage
Fungus Sliver
Simic Initiate

as well as a test file for feral hydra, missing from my last commit.
and daily build.
2010-04-03 23:50:39 +00:00

151 lines
4.0 KiB
C++

#ifndef _WEVENT_H_
#define _WEVENT_H_
#include <iostream>
#include "PhaseRing.h"
class MTGCardInstance;
class MTGGameZone;
class Damage;
class Phase;
class Targetable;
class ManaPool;
class WEvent {
public:
enum {
NOT_SPECIFIED = 0,
CHANGE_ZONE = 1,
DAMAGE = 2,
CHANGE_PHASE = 3,
};
//for getTargets, in case event has more than one possible "target", like with damage events.
enum {
TARGET_NONE = 0,
TARGET_TO,
TARGET_FROM,
};
int type; //Deprecated, use dynamic casting instead
WEvent(int type = NOT_SPECIFIED);
virtual ~WEvent() {};
virtual std::ostream& toString(std::ostream& out) const;
virtual int getValue() {return 0;};
virtual Targetable * getTarget(int target) {return 0;};
};
struct WEventZoneChange : public WEvent {
MTGCardInstance * card;
MTGGameZone * from;
MTGGameZone * to;
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
virtual ~WEventZoneChange() {};
virtual std::ostream& toString(std::ostream& out) const;
virtual Targetable * getTarget(int target);
};
struct WEventDamage : public WEvent {
Damage * damage;
WEventDamage(Damage * damage);
virtual std::ostream& toString(std::ostream& out) const;
virtual int getValue();
virtual Targetable * getTarget(int target);
};
struct WEventPhaseChange : public WEvent {
Phase * from;
Phase * to;
WEventPhaseChange(Phase * from, Phase * to);
};
//Abstract class of event when a card's status changes
struct WEventCardUpdate : public WEvent {
MTGCardInstance * card;
WEventCardUpdate(MTGCardInstance * card);
};
//Event when a card gains/looses types
struct WEventCardChangeType : public WEventCardUpdate {
int type;
bool before;
bool after;
WEventCardChangeType(MTGCardInstance * card, int type, bool before, bool after);
};
//Event when a card is tapped/untapped
struct WEventCardTap : public WEventCardUpdate {
bool before;
bool after;
WEventCardTap(MTGCardInstance * card, bool before, bool after);
virtual Targetable * getTarget(int target);
};
//Event when a card's "attacker" status changes
//before:Player/Planeswalker that card was attacking previously
//after: Player/Planeswalker that card is attacking now
struct WEventCreatureAttacker : public WEventCardUpdate {
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
struct WEventCreatureBlocker : public WEventCardUpdate {
MTGCardInstance * before;
MTGCardInstance * after;
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
};
//Event sent when blockers have been chosen and they
//cannot be changed any more.
struct WEventBlockersChosen : public WEvent {
};
//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.
struct WEventCreatureBlockerRank : public WEventCardUpdate {
MTGCardInstance * exchangeWith;
MTGCardInstance * attacker;
WEventCreatureBlockerRank(MTGCardInstance * card,MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
};
//Event when a combat phase step ends
struct WEventCombatStepChange : public WEvent
{
CombatStep step;
WEventCombatStepChange(CombatStep);
};
//Event when a mana is engaged
//color : color
struct WEventEngageMana : public WEvent {
int color;
MTGCardInstance* card;
ManaPool * destination;
WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination);
};
//Event when a mana is consumed
//color : color
struct WEventConsumeMana : public WEvent {
int color;
ManaPool * source;
WEventConsumeMana(int color, ManaPool * source);
};
//Event when a manapool is emptied
//color : color
struct WEventEmptyManaPool : public WEvent {
ManaPool * source;
WEventEmptyManaPool(ManaPool * source);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif