auto=resist(grass,10)
//Pokewon modify
//Resist ability
class AResistAbility: public MTGAbility
{
public:
MTGCardInstance * opponents[20];
int nbOpponents;
int PowerModifier;
string CarSubType;
AResistAbility(int _id, MTGCardInstance * _source,int _PowerModifier,string _CarSubType) :
MTGAbility(_id, _source)
{
PowerModifier = _PowerModifier;
CarSubType = _CarSubType;
nbOpponents = 0;
}
int receiveEvent(WEvent * event)
{
//WEventDamage
if (dynamic_cast<WEventBlockersChosen*> (event))
{
nbOpponents = 0;
if(! source->isDefenser())
return 0;
MTGCardInstance * opponent = source->getNextOpponent();
if(! opponent->hasSubtype(CarSubType))
return 0;
if(opponent->power == 0)
return 0;
if (PowerModifier == 0)
{
PowerModifier = opponent->power;
}
else if (opponent->power - PowerModifier < 0 )
PowerModifier = opponent->power;
AInstantPowerToughnessModifierUntilEOT * a = NEW AInstantPowerToughnessModifierUntilEOT(opponent->getId(), opponent, opponent, NEW WParsedPT(PowerModifier * -1 ,0));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(1, opponent,opponent, a);
wrapper->addToGame();
return 1;
}
}
virtual ostream& toString(ostream& out) const
{
out << "AResistAbility ::: opponents : " << opponents << " ; nbOpponents : " << nbOpponents << " (";
return MTGAbility::toString(out) << ")";
}
AResistAbility * clone() const
{
AResistAbility * a = NEW AResistAbility(*this);
a->isClone = 1;
return a;
}
};
rodrigo.demoura wrote:I am making some modifications to adapt the source code for Wagic to play pokemon tcg.
Have already created three abilities:
Pokeharm: (source takes damage in the form of counters 0/-10) ability equal to wither
Weakness (subtype, value): (source takes double damage or a damage value)
Resist (subtype, value): (source prevents a damage value)
But I have some doubts:
How do I implement the ability Must Block? In this game only one creature can attack and defend each turn
How do I implement a rule to check for an active creature in the game? I would like to create the rules for the game checks each turn
and it was stored in a variable. With this I create an activation cost that depends on what the creature is active.
Something like {A} {U}: 10 / 0
or
target (creature [-Active] | opponentBattlefield):
I create a dirty way to do this, but I want to improve it and code on source to create a hability
Rules.txt
- Code: Select all
[INIT]
mode=mtg
[PLAYERS]
life:6
auto=shuffle
auto=draw:7
auto=@each my draw:draw:1
auto=lord(creature) pokeharm
auto=lord(creature) vigilance
#Can be just one active pokemon on Battlefield
auto=@each my combatbegins:aslongas(creature|myBattlefield) token(-1r)
auto=lord(creature[-counter{0/0.1.Active}]) cantattack
auto=lord(creature[-counter{0/0.1.Active}]) cantblock
#Only 6 creatures in play
auto=aslongas(creature|myBattlefield)) >5 maxCast(creature)0
#Attach only one energy card per turn
auto=maxCast(Energy)1
The Rule card
- Code: Select all
[card]
name=Active Pokewon
auto=aslongas(creature[counter{0/0.1.Active}]|myBattlefield):moveto(stack)
auto=@movedto(this|exile):counter(0/0,1,Active) target(creature|myBattlefield)
auto=moveto(exile)
type=Nothing
id=-1r
[/card]
GameObserver.h
public:
void activeCreature();
GameObserver.cpp
...
...
...
void GameObserver::NextGamePhase ()
{
...
...
...
case Constants::MTG_PHASE_FIRSTMAIN:
activeCreature();
break;
...
...
...
}
void GameObserver::activeCreature()
{
}
Users browsing this forum: No registered users and 0 guests