this commit adds AVRs new ability soulbond.

it requires an update to your mtg rules txt...
the coding is as follows

[card]
name=Arbor Elf
mana={g}
auto=soulbond 1/3
auto=soulbond {t}:add{g}
abilities=soulbond
type=Creature
subtype=Elf Druid
power=1
toughness=1
[/card]

auto=soulbond *any ability supported by wagic*
abilities=soulbond

the above arbor elf gives itself and its soulbond creature a 1/3 bonus and the ability to tap for green mana.
This commit is contained in:
omegablast2002@yahoo.com
2012-07-16 14:59:46 +00:00
parent 7024d195fa
commit 0dbcd86b89
12 changed files with 407 additions and 12 deletions
+160 -7
View File
@@ -1958,6 +1958,11 @@ public:
MTGAbility * toAdd = ability->clone();
toAdd->forceDestroy = -1;
toAdd->target = target;
if(toAdd->getActionTc())
{
toAdd->reactToTargetClick(source);
return 1;
}
toAdd->addToGame();
return 1;
}
@@ -1979,7 +1984,48 @@ public:
SAFE_DELETE(ability);
}
};
//generic addtogame
class GenericAddToGame: public InstantAbility, public NestedAbility
{
public:
GenericAddToGame(GameObserver* observer, int _id, MTGCardInstance * _source, Damageable * _target, MTGAbility * ability) :
InstantAbility(observer, _id, _source,_target), NestedAbility(ability)
{
ability->target = _target;
}
int addToGame()
{
InstantAbility::addToGame();
return 1;
}
int resolve()
{
MTGAbility * toAdd = ability->clone();
toAdd->target = target;
if(toAdd->getActionTc())
return toAdd->reactToTargetClick(source);
return toAdd->addToGame();
}
const char * getMenuText()
{
return ability->getMenuText();
}
GenericAddToGame * clone() const
{
GenericAddToGame * a = NEW GenericAddToGame(*this);
a->ability = ability->clone();
return a;
}
~GenericAddToGame()
{
SAFE_DELETE(ability);
}
};
//Circle of Protections
class ACircleOfProtection: public TargetAbility
{
@@ -2233,7 +2279,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
@@ -2344,7 +2390,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
@@ -2463,8 +2509,11 @@ public:
if (skills.find(card) != skills.end())
{
if(!game->removeObserver(skills[card]))
{
skills[card]->destroy();
skills.erase(card);
}
if(skills[card])
skills.erase(card);
}
return 1;
}
@@ -2489,7 +2538,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
@@ -2534,6 +2583,15 @@ public:
AABlock * clone() const;
};
/* assign a creature as a pair to target */
class PairCard: public InstantAbility
{
public:
PairCard(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
PairCard * clone() const;
};
/* create a parent child association between cards */
class AAConnect: public InstantAbility
{
@@ -2990,6 +3048,101 @@ public:
};
///
//a paired lord
class APaired: public MTGAbility, public NestedAbility
{
public:
MTGAbility * a;
MTGAbility * b;
APaired(GameObserver* observer, int _id, MTGCardInstance * _source, Damageable * _target, MTGAbility * ability) :
MTGAbility(observer, _id, _source, _target), NestedAbility(ability)
{
ability->source = source;
ability->target = target;
a = NULL;
}
int removeFromGame()
{
return removeAbilityFromGame();
}
int addToGame()
{
return MTGAbility::addToGame();
}
void Update(float dt)
{
resolve();
}
int resolve()
{
if (source->myPair)
{
addAbilityToGame();
}
else
{
removeAbilityFromGame();
}
if (ability->oneShot) a = NULL; //allows to call the effect several times
return 1;
}
int addAbilityToGame()
{
if (a && b) return 0;
a = ability->clone();
b = ability->clone();
a->source = source;
a->target = source;
b->source = source->myPair;
b->target = source->myPair;
if (a->oneShot)
{
a->resolve();
b->resolve();
SAFE_DELETE(a);
SAFE_DELETE(b);
}
else
{
a->addToGame();
b->addToGame();
}
return 1;
}
int destroy()
{
return removeAbilityFromGame();
}
int removeAbilityFromGame()
{
if (!a && !b) return 0;
game->removeObserver(a);
a = NULL;
game->removeObserver(b);
b = NULL;
return 1;
}
~APaired()
{
SAFE_DELETE(ability);
}
APaired * clone() const
{
APaired * a = NEW APaired(*this);
a->ability = ability->clone();
return a;
}
};
//Foreach (plague rats...)
class AForeach: public ListMaintainerAbility, public NestedAbility
{
@@ -3028,7 +3181,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
@@ -3138,7 +3291,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
@@ -3229,7 +3382,7 @@ public:
if (a->oneShot)
{
a->resolve();
delete (a);
SAFE_DELETE(a);
}
else
{
+1
View File
@@ -155,6 +155,7 @@ public:
int isAttacker();
Targetable * isAttacking;
MTGCardInstance * storedCard;
MTGCardInstance * myPair;
MTGCardInstance * createSnapShot();
MTGCardInstance * storedSourceCard;
MTGCardInstance * isDefenser();
+2 -1
View File
@@ -218,8 +218,9 @@ class Constants
NOMANA = 97,
ONLYMANA = 98,
POISONDAMAGER = 99,
soulbond = 100,
NB_BASIC_ABILITIES = 100,
NB_BASIC_ABILITIES = 101,
RARITY_S = 'S', //Special Rarity
+18 -1
View File
@@ -255,7 +255,24 @@ public:
virtual MTGBlockRule * clone() const;
~MTGBlockRule();
};
//soulbond rule
class MTGSoulbondRule: public PermanentAbility
{
public:
vector<MTGCardInstance*>soulbonders;
TargetChooser * tcb;
MTGAbility * pairAbility;
MTGAbility * targetAbility;
MTGAbility * targetAbility1;
MTGAbility * mod;
MTGAbility * activatePairing;
vector<MTGAbility*>pairing;
MTGSoulbondRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event);
virtual ostream& toString(ostream& out) const;
virtual MTGSoulbondRule * clone() const;
~MTGSoulbondRule();
};
/* Persist Rule */
class MTGPersistRule: public PermanentAbility
{
+19
View File
@@ -279,6 +279,25 @@ public:
virtual bool equals(TargetChooser * tc);
};
class pairableChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
pairableChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
TypeTargetChooser(observer, "creature|mybattlefield",_zones, _nbzones, card, _maxtargets, other, targetMin)
{
}
;
pairableChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) :
TypeTargetChooser(observer, "creature|mybattlefield", card, _maxtargets, other,targetMin)
{
}
;
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
virtual pairableChooser * clone() const;
virtual bool equals(TargetChooser * tc);
};
class myCursesChooser: public TypeTargetChooser
{
public: