this is the first basic rules of kais mod.

added parentchildrule which currently only handles the removel of children if a parent dies, but will be extended to handle other actions based on event receiving that deal with child and parent association.

add keyword targetable ability "connect"
connect means "the source adds the target to it's parent vector, the target adds the source to it's children vector"
this can be multitargeted, so it is possible that 
"Big Bad Dragon" can live it 2 different domains. 
not sure if this was even asked for, but i thought it would be cool to be able to say
"to play big bad creature you need to give it 2 homes"
or
"big bad creature can live in upto 4 homes"
this adds a level of stratigy, becuase now big bad creature can have "all creatures which share a domain with big bad creature gain +2/+2"...or "all domains that city planner live in gain 1 capacity"
but also add the possibility of faster removel from a card like
"destroy all creatures on target domain".
i thought it would be a nice add to kai rules.

connect clears a target= on a card after connecting...this is to avoid abilities transfering to the target, unless you want it to effect the target like
"tap target domain as this becomes a inhabatant"
target=domain
auto=tap
auto=connect
auto=<==this line on will not be targeting the domain
This commit is contained in:
omegablast2002@yahoo.com
2011-09-10 19:37:44 +00:00
parent 4e963c168f
commit c0e8dcb1c9
7 changed files with 121 additions and 0 deletions

View File

@@ -3214,6 +3214,15 @@ public:
}
};
/* create a parent child association between cards */
class AAConnect: public ActivatedAbility
{
public:
AAConnect(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
AAConnect * clone() const;
};
// Add life of gives damage if a given zone has more or less than [condition] cards at the beginning of [phase]
//Ex : the rack, ivory tower...
class ALifeZoneLink: public MTGAbility

View File

@@ -43,6 +43,9 @@ protected:
int removeBlocker(MTGCardInstance * c);
int init();
public:
vector<MTGCardInstance*>parentCards;
vector<MTGCardInstance*>childrenCards;
int setAttacker(int value);
int setDefenser(MTGCardInstance * c);
MTGGameZone * currentZone;

View File

@@ -408,6 +408,17 @@ public:
virtual MTGDeathtouchRule * clone() const;
};
/* handling parentchild */
class ParentChildRule: public MTGAbility
{
public:
ParentChildRule(int _id);
map<MTGCardInstance*,vector<MTGCardInstance*> > victems;
int receiveEvent(WEvent * event);
virtual ostream& toString(ostream& out) const;
int testDestroy();
virtual ParentChildRule * clone() const;
};
/* HUD Display */
class HUDString

View File

@@ -3831,6 +3831,36 @@ ABlinkGeneric::~ABlinkGeneric()
SAFE_DELETE(ability);
}
// target becomes a parent of card(source)
AAConnect::AAConnect(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
ActivatedAbility(id, card, _cost, 0)
{
target = _target;
}
int AAConnect::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
while (_target->next)
_target = _target->next;
_target->childrenCards.push_back(source);
source->parentCards.push_back(_target);
if(source->target)
source->target = NULL;
//clearing the source target allows us to use target= line
//without creating side effects on any other abilities a card has
//connect has to be the first ability in the cards lines unless you want it to do effects to the targeted card!!!
}
return 1;
}
AAConnect * AAConnect::clone() const
{
return NEW AAConnect(*this);
}
//Tutorial Messaging

View File

@@ -44,6 +44,7 @@ void DuelLayers::init()
action->Add(NEW MTGDeathtouchRule(-1));
action->Add(NEW OtherAbilitiesEventReceiver(-1));
action->Add(NEW MTGMorphCostRule(-1));
action->Add(NEW ParentChildRule(-1));
//Other display elements
action->Add(NEW HUDDisplay(-1));

View File

@@ -2397,6 +2397,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//create an association between cards.
found = s.find("connect");
if (found != string::npos)
{
MTGAbility * a = NEW AAConnect(id, card, target);
a->oneShot = 1;
return a;
}
DebugTrace(" no matching ability found. " << s);
return NULL;
}

View File

@@ -2319,3 +2319,61 @@ MTGDeathtouchRule * MTGDeathtouchRule::clone() const
{
return NEW MTGDeathtouchRule(*this);
}
//
//kai mod
ParentChildRule::ParentChildRule(int _id) :
MTGAbility(_id, NULL)
{
}
;
int ParentChildRule::receiveEvent(WEvent * event)
{
WEventZoneChange * z = dynamic_cast<WEventZoneChange *> (event);
if (z)
{
MTGCardInstance * card = z->card->previous;
if(!card)
{
return 0;
}
if(!card->childrenCards.size())
return 0;
Player * p = card->controller();
if (z->from == p->game->inPlay)
{
for(unsigned int w = 0;w < card->childrenCards.size();w++)
{
MTGCardInstance * child = card->childrenCards[w];
if(child == NULL)
continue;
if(child->parentCards.size() < 2)
child->controller()->game->putInGraveyard(child);
else//allows a card to declare 2 homes, as long as it has a home it can stay inplay.
{
for(unsigned int myParent = 0;myParent < child->parentCards.size();myParent++)
{
if(child->parentCards[myParent] == card)
child->parentCards.erase(child->parentCards.begin() + myParent);
}
}
}
}
return 1;
}
return 0;
}
ostream& ParentChildRule::toString(ostream& out) const
{
out << "ParentChildRule ::: (";
return MTGAbility::toString(out) << ")";
}
int ParentChildRule::testDestroy()
{
return 0;
}
ParentChildRule * ParentChildRule::clone() const
{
return NEW ParentChildRule(*this);
}