puresteel paladin support

rehook and newhook for equipments inplay...
retarget and newtarget don't support stonehewer basic because the card
is refreshed and stone hewer basic creates equipment/s as tokens...
This commit is contained in:
Anthony Calosa
2015-10-23 15:25:30 +08:00
parent 2d5d367ee6
commit 378a54fb62
5 changed files with 87 additions and 47 deletions
+34 -3
View File
@@ -1739,8 +1739,8 @@ AAFrozen * AAFrozen::clone() const
}
// chose a new target for an aura or enchantment and equip it note: VERY basic right now.
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget)
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost, bool reequip, bool newhook) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget),reequip(reequip),newhook(newhook)
{
target = _target;
}
@@ -1753,7 +1753,7 @@ int AANewTarget::resolve()
_target = source;
source = (MTGCardInstance *) target;
}
if (_target)
if (_target && !reequip)
{
while (_target->next)
_target = _target->next;
@@ -1790,6 +1790,37 @@ int AANewTarget::resolve()
}
}
if (_target && _target->currentZone == _target->controller()->game->battlefield && reequip)
{
if(!newhook)
{
_target = source;
source = (MTGCardInstance *) target;
}
else
{
while (_target->next)
_target = _target->next;
}
if(_target->hasSubtype(Subtypes::TYPE_EQUIPMENT))
{
for (size_t i = 1; i < game->mLayers->actionLayer()->mObjects.size(); i++)
{
MTGAbility * a = ((MTGAbility *) game->mLayers->actionLayer()->mObjects[i]);
AEquip * eq = dynamic_cast<AEquip*> (a);
if (eq && eq->source == _target)
{
((AEquip*)a)->unequip();
((AEquip*)a)->equip(source);
}
}
}
if(!newhook)
{
target = source;
source = _target;
}
}
return 1;
}
+9 -1
View File
@@ -3194,7 +3194,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//get a new target
//get a new target - retarget and newtarget makes the card refreshed - from exile to play...
if ((s.find("retarget") != string::npos) || s.find("newtarget") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, (s.find("retarget") != string::npos));
@@ -3202,6 +3202,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//get a new target for puresteel paladin...etc for equipments inplay only.. newhook & rehook supports stone hewer basic... the card is reequipped
if ((s.find("rehook") != string::npos) || s.find("newhook") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, false,NULL,true,(s.find("newhook") != string::npos));
a->oneShot = 1;
return a;
}
//morph
found = s.find("morph");
if (found != string::npos)