added",once" tag for phaseaction, to denote that the effect is only to happen once before forcedestroy is declared.
auto=@movedTo(graveyard) from(this|battlefield):phaseaction[endofturn,once] token(Bird,Creature Bird,4/4,red,flying)
This commit is contained in:
@@ -3884,10 +3884,11 @@ public:
|
|||||||
bool next;
|
bool next;
|
||||||
bool myturn;
|
bool myturn;
|
||||||
bool opponentturn;
|
bool opponentturn;
|
||||||
|
bool once;
|
||||||
Player * abilityOwner;
|
Player * abilityOwner;
|
||||||
|
|
||||||
APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
||||||
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true);
|
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
@@ -3902,7 +3903,7 @@ public:
|
|||||||
string sAbility;
|
string sAbility;
|
||||||
APhaseAction * ability;
|
APhaseAction * ability;
|
||||||
APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
||||||
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false);
|
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
APhaseActionGeneric * clone() const;
|
APhaseActionGeneric * clone() const;
|
||||||
|
|||||||
@@ -2922,8 +2922,8 @@ AUpkeep::~AUpkeep()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//A Phase based Action
|
//A Phase based Action
|
||||||
APhaseAction::APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
APhaseAction::APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
|
||||||
MTGAbility(_id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn)
|
MTGAbility(_id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once)
|
||||||
{
|
{
|
||||||
abilityId = _id;
|
abilityId = _id;
|
||||||
abilityOwner = card->controller();
|
abilityOwner = card->controller();
|
||||||
@@ -2969,7 +2969,7 @@ void APhaseAction::Update(float dt)
|
|||||||
a->resolve();
|
a->resolve();
|
||||||
delete (a);
|
delete (a);
|
||||||
delete (ability);
|
delete (ability);
|
||||||
if(this->oneShot)
|
if(this->oneShot || once)
|
||||||
{
|
{
|
||||||
this->forceDestroy = 1;
|
this->forceDestroy = 1;
|
||||||
}
|
}
|
||||||
@@ -3010,11 +3010,11 @@ APhaseAction::~APhaseAction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the main ability
|
// the main ability
|
||||||
APhaseActionGeneric::APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
APhaseActionGeneric::APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
|
||||||
InstantAbility(_id, source, target)
|
InstantAbility(_id, source, target)
|
||||||
{
|
{
|
||||||
MTGCardInstance * _target = target;
|
MTGCardInstance * _target = target;
|
||||||
ability = NEW APhaseAction(_id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn);
|
ability = NEW APhaseAction(_id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn,once);
|
||||||
}
|
}
|
||||||
|
|
||||||
int APhaseActionGeneric::resolve()
|
int APhaseActionGeneric::resolve()
|
||||||
|
|||||||
@@ -1142,11 +1142,26 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
found = s.find("phaseactionmulti");
|
found = s.find("phaseactionmulti");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
size_t start = s.find("[");
|
size_t start = s.find("[");
|
||||||
size_t end = s.find("]", start);
|
size_t end = s.find("]", start);
|
||||||
string s1 = s.substr(start + 1, end - start - 1);
|
string s1 = s.substr(start + 1, end - start - 1);
|
||||||
int phase = Constants::MTG_PHASE_UPKEEP;
|
int phase = Constants::MTG_PHASE_UPKEEP;
|
||||||
|
for (int i = 0; i < Constants::NB_MTG_PHASES; i++)
|
||||||
|
{
|
||||||
|
if (s1.find(Constants::MTGPhaseCodeNames[i]) != string::npos)
|
||||||
|
{
|
||||||
|
phase = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool opponentturn = true,myturn = true;
|
||||||
|
if(s1.find("my") != string::npos)
|
||||||
|
{
|
||||||
|
opponentturn = false;
|
||||||
|
}
|
||||||
|
if(s1.find("opponent") != string::npos)
|
||||||
|
{
|
||||||
|
myturn = false;
|
||||||
|
}
|
||||||
if (s1.find("combatends") != string::npos)
|
if (s1.find("combatends") != string::npos)
|
||||||
{
|
{
|
||||||
phase = Constants::MTG_PHASE_COMBATEND;
|
phase = Constants::MTG_PHASE_COMBATEND;
|
||||||
@@ -1173,13 +1188,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
next = false;
|
next = false;
|
||||||
}
|
}
|
||||||
|
bool once = false;
|
||||||
|
if (s1.find(",once") != string::npos)
|
||||||
|
{
|
||||||
|
once = true;
|
||||||
|
}
|
||||||
string sAbility = s.substr(end + 1);
|
string sAbility = s.substr(end + 1);
|
||||||
MTGCardInstance * _target = NULL;
|
MTGCardInstance * _target = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
_target = spell->getNextCardTarget();
|
_target = spell->getNextCardTarget();
|
||||||
if(!_target)
|
if(!_target)
|
||||||
_target = target;
|
_target = target;
|
||||||
return NEW APhaseActionGeneric(id, card,_target,sAbility, restrictions, phase,sourceinPlay,next);
|
return NEW APhaseActionGeneric(id, card,_target, sAbility, restrictions, phase,sourceinPlay,next,myturn,opponentturn,once);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Multiple abilities for ONE cost
|
//Multiple abilities for ONE cost
|
||||||
@@ -1660,13 +1680,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
next = false;
|
next = false;
|
||||||
}
|
}
|
||||||
|
bool once = false;
|
||||||
|
if (s1.find(",once") != string::npos)
|
||||||
|
{
|
||||||
|
once = true;
|
||||||
|
}
|
||||||
string sAbility = s.substr(end + 1);
|
string sAbility = s.substr(end + 1);
|
||||||
MTGCardInstance * _target = NULL;
|
MTGCardInstance * _target = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
_target = spell->getNextCardTarget();
|
_target = spell->getNextCardTarget();
|
||||||
if(!_target)
|
if(!_target)
|
||||||
_target = target;
|
_target = target;
|
||||||
return NEW APhaseActionGeneric(id, card,_target, sAbility, restrictions, phase,sourceinPlay,next,myturn,opponentturn);
|
return NEW APhaseActionGeneric(id, card,_target, sAbility, restrictions, phase,sourceinPlay,next,myturn,opponentturn,once);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Upkeep Cost
|
//Upkeep Cost
|
||||||
|
|||||||
Reference in New Issue
Block a user