added basic card draw replacement,

auto=replacedraw choice damage:2

auto=replacedraw choice draw:2 noreplace

notice noreplace exempts the draw from sending a draw event. draw events and drawn events are seperate events.

added dredge and it's rules.

[card]
name=Dakmor Salvage
auto=tap
auto={t}:add{b}
dredge=dredge(2)
text=Dakmor Salvage enters the battlefield tapped. -- {T}: Add {B} to your mana pool. -- Dredge 2 (If you would draw a card, instead you may put exactly two cards from the top of your library into your graveyard. If you do, return this card from your graveyard to your hand. Otherwise, draw a card.)
type=Land
[/card]
This commit is contained in:
omegablast2002@yahoo.com
2013-01-20 20:13:07 +00:00
parent 0709aaefb8
commit ca3dc49d71
20 changed files with 463 additions and 31 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ public:
int reactToTargetClick(ActionElement * ability, Targetable * card);
int stillInUse(MTGCardInstance * card);
void setMenuObject(Targetable * object, bool must = false);
void setCustomMenuObject(Targetable * object, bool must = false,vector<MTGAbility*>abilities = vector<MTGAbility*>());
void setCustomMenuObject(Targetable * object, bool must = false,vector<MTGAbility*>abilities = vector<MTGAbility*>(),string customName = "");
void ButtonPressed(int controllerid, int controlid);
void ButtonPressedOnMultipleChoice(int choice = -1);
void doReactTo(int menuIndex);
+24 -4
View File
@@ -1105,7 +1105,8 @@ public:
MTGAbility * mClone;
vector<MTGAbility*>abilities;
Player * who;
MenuAbility(GameObserver* observer, int _id, Targetable * target, MTGCardInstance * _source, bool must = false, vector<MTGAbility*>abilities = vector<MTGAbility*>(),Player * who = NULL);
string newNameString;
MenuAbility(GameObserver* observer, int _id, Targetable * target, MTGCardInstance * _source, bool must = false, vector<MTGAbility*>abilities = vector<MTGAbility*>(),Player * who = NULL,string _newName = "");
void Update(float dt);
int resolve();
const char * getMenuText();
@@ -1393,9 +1394,9 @@ class AADrawer: public ActivatedAbilityTP
public:
string nbcardsStr;
bool noReplace;
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
TargetChooser::UNSET);
TargetChooser::UNSET,bool noReplace = false);
int resolve();
const char * getMenuText();
AADrawer * clone() const;
@@ -2622,7 +2623,14 @@ public:
int resolve();
PairCard * clone() const;
};
//pick a card to dredge
class dredgeCard: public InstantAbility
{
public:
dredgeCard(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
dredgeCard * clone() const;
};
/* create a parent child association between cards */
class AAConnect: public InstantAbility
{
@@ -4300,6 +4308,18 @@ public:
};
class ADrawReplacer: public MTGAbility
{
public:
REDrawReplacement * re;
MTGAbility * replacer;
bool OtherPlayer;
ADrawReplacer(GameObserver* observer, int id, MTGCardInstance * source, MTGAbility * _replace = NULL,bool otherPlayer = false);
int addToGame();
int destroy();
ADrawReplacer * clone() const;
~ADrawReplacer();
};
/*
Specific Classes
*/
+2 -1
View File
@@ -66,6 +66,7 @@ public:
int power;
int toughness;
int suspendedTime;
int dredgeAmount;
vector<int>types;
CardPrimitive();
@@ -110,7 +111,7 @@ public:
bool isCreature();
bool isLand();
bool isSpell();
int dredge();
void setPower(int _power);
int getPower();
void setToughness(int _toughness);
+1
View File
@@ -99,6 +99,7 @@ public:
int fresh;
int MaxLevelUp;
int kicked;
int dredge;
bool isDualWielding;
bool stillNeeded;
Player * lastController;
+18
View File
@@ -272,6 +272,24 @@ public:
virtual ostream& toString(ostream& out) const;
virtual MTGSoulbondRule * clone() const;
};
/*dredge*/
class MTGDredgeRule: public PermanentAbility, public ReplacementEffect
{
public:
vector<MTGCardInstance*>soulbonders;
TargetChooser * tcb;
MTGAbility * dredgeAbility;
MTGAbility * targetAbility;
MTGAbility * targetAbilityAdder;
MTGAbility * targetAbility1;
MTGAbility * mod;
MTGAbility * activateDredge;
vector<MTGAbility*>pairing;
MTGDredgeRule(GameObserver* observer, int _id);
WEvent * replace(WEvent *e);
virtual ostream& toString(ostream& out) const;
virtual MTGDredgeRule * clone() const;
};
/* Persist Rule */
class MTGPersistRule: public PermanentAbility
{
+13 -3
View File
@@ -49,12 +49,22 @@ public:
WEvent * replace(WEvent *e);
~RECountersPrevention();
};
class ReplacementEffects
class REDrawReplacement: public ReplacementEffect
{
protected:
list<ReplacementEffect *> modifiers;
MTGAbility * source;
public:
Player * DrawerOfCard;
MTGAbility * replacementAbility;
REDrawReplacement(MTGAbility * _source, Player * Drawer = NULL, MTGAbility * replaceWith = NULL);
WEvent * replace(WEvent *e);
~REDrawReplacement();
};
class ReplacementEffects
{
public:
list<ReplacementEffect *> modifiers;
ReplacementEffects();
WEvent * replace(WEvent *e);
int add(ReplacementEffect * re);
+19
View File
@@ -298,6 +298,25 @@ public:
virtual bool equals(TargetChooser * tc);
};
class dredgeChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
dredgeChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
TypeTargetChooser(observer, "*|mygraveyard",_zones, _nbzones, card, _maxtargets, other, targetMin)
{
}
;
dredgeChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) :
TypeTargetChooser(observer, "*|mygraveyard", card, _maxtargets, other,targetMin)
{
}
;
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
virtual dredgeChooser * clone() const;
virtual bool equals(TargetChooser * tc);
};
class myCursesChooser: public TypeTargetChooser
{
public:
+9 -1
View File
@@ -12,6 +12,8 @@ class Targetable;
class ManaPool;
class AACounter;
class Counters;
class MTGAbility;
class DrawAction;
class WEvent {
public:
@@ -221,7 +223,13 @@ struct WEventcardDraw : public WEvent {
int nb_cards;
virtual Targetable * getTarget(Player * player);
};
//event for a card draw ability resolving
struct WEventDraw : public WEvent {
WEventDraw(Player * player,int nb_cards,MTGAbility * drawer);
Player * player;
int nb_cards;
MTGAbility * drawAbility;
};
//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.