Merge pull request #694 from kevlahnota/master

Some changes
This commit is contained in:
Anthony Calosa
2016-06-14 21:31:28 +08:00
committed by GitHub
17 changed files with 203 additions and 48 deletions
@@ -16,6 +16,7 @@ auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=attackcostrule
auto=blockrule
auto=combattriggerrule
auto=legendrule
+1
View File
@@ -15,6 +15,7 @@ auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=attackcostrule
auto=blockrule
auto=combattriggerrule
auto=legendrule
+1
View File
@@ -19,6 +19,7 @@ auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=attackcostrule
auto=blockrule
auto=combattriggerrule
auto=legendrule
@@ -1,4 +1,17 @@
grade=borderline
#planeswalker and creature attack cost...
[card]
name=Archangel of Tithes
abilities=flying
auto=this(untapped) lord(creature|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{1}]] name(pay 1 mana) donothing?cantattack all(this)]))
auto=@combat(attacking) source(this):all(creature|opponentbattlefield) transforms((,newability[pay[[{1}]] name(pay 1 mana) donothing?cantblock all(this)]))
text=Flying -- As long as Archangel of Tithes is untapped, creatures can't attack you or a planeswalker you control unless their controller pays {1} for each of those creatures. -- As long as Archangel of Tithes is attacking, creatures can't block unless their controller pays {1} for each of those creatures.
mana={1}{W}{W}{W}
type=Creature
subtype=Angel
power=3
toughness=5
[/card]
[card]
name=Autumn Willow
abilities=opponentshroud,shroud
+15 -17
View File
@@ -3076,8 +3076,9 @@ toughness=6
[/card]
[card]
name=Angel of Jubilation
abilities=flying,cantpaylifeorsaccreatures
abilities=flying,cantpaylife
auto=lord(other creature[-black]|mybattlefield) 1/1
auto=lord(creature) cantbesacrified
text=Flying -- Other nonblack creatures you control get +1/+1. -- Players can't pay life or sacrifice creatures to cast spells or activate abilities.
mana={1}{W}{W}{W}
type=Creature
@@ -4300,18 +4301,6 @@ power=3
toughness=4
[/card]
[card]
name=Archangel of Tithes
abilities=flying
auto=this(untapped) lord(creature|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{1}]] name(pay 1 mana) donothing?cantattack all(this)]))
auto=@combat(attacking) source(this):all(creature|opponentbattlefield) transforms((,newability[pay[[{1}]] name(pay 1 mana) donothing?cantblock all(this)]))
text=Flying -- As long as Archangel of Tithes is untapped, creatures can't attack you or a planeswalker you control unless their controller pays {1} for each of those creatures. -- As long as Archangel of Tithes is attacking, creatures can't block unless their controller pays {1} for each of those creatures.
mana={1}{W}{W}{W}
type=Creature
subtype=Angel
power=3
toughness=5
[/card]
[card]
name=Archangel's Light
auto=life:twicetype:*:mygraveyard
auto=moveto(myLibrary) all(*|myGraveyard) && shuffle
@@ -29329,7 +29318,7 @@ type=Instant
name=Elephant Grass
auto=cumulativeupcost[{1}] sacrifice
auto=lord(creature[black]|opponentbattlefield) cantattack
auto=lord(creature[-black]|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{2}]] name(pay 2 mana) donothing?cantattack all(this)]))
auto=lord(creature|opponentbattlefield) transforms((,newability[attackcost:2]))
text=Cumulative upkeep {1} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.) -- Black creatures can't attack you. -- Nonblack creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={G}
type=Enchantment
@@ -38881,7 +38870,7 @@ subtype=Aura
[/card]
[card]
name=Ghostly Prison
auto=lord(creature|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{2}]] name(pay 2 mana) donothing?cantattack all(this)]))
auto=lord(creature|opponentbattlefield) transforms((,newability[attackcost:2]))
text=Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={2}{W}
type=Enchantment
@@ -54504,6 +54493,15 @@ power=3
toughness=3
[/card]
[card]
name=Koskun Falls
auto=upcost[{T(creature|mybattlefield)}] sacrifice
auto=lord(creature|opponentbattlefield) transforms((,newability[attackcost:2]))
auto=@movedTo(enchantment[world]|battlefield):sacrifice all(this)
text=At the beginning of your upkeep, sacrifice Koskun Falls unless you tap an untapped creature you control. -- Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={2}{B}{B}
type=World Enchantment
[/card]
[card]
name=Koskun Keep
auto={T}:Add{1}
auto={1}{T}:Add{R}
@@ -75630,7 +75628,7 @@ toughness=1
[/card]
[card]
name=Propaganda
auto=lord(creature|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{2}]] name(pay 2 mana) donothing?cantattack all(this)]))
auto=lord(creature|opponentbattlefield) transforms((,newability[attackcost:2]))
text=Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={2}{U}
type=Enchantment
@@ -114260,7 +114258,7 @@ subtype=Aura
[card]
name=Windborn Muse
abilities=flying
auto=lord(creature|opponentbattlefield) transforms((,newability[@each mycombatbegins:pay[[{2}]] name(pay 2 mana) donothing?cantattack all(this)]))
auto=lord(creature|opponentbattlefield) transforms((,newability[attackcost:2]))
text=Flying (This creature can't be blocked except by creatures with flying or reach.) -- Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={3}{W}
type=Creature
@@ -12123,12 +12123,6 @@ power=*
toughness=*
[/card]
[card]
name=Koskun Falls
text=At the beginning of your upkeep, sacrifice Koskun Falls unless you tap an untapped creature you control. -- Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
mana={2}{B}{B}
type=World Enchantment
[/card]
[card]
name=Kozilek's Channeler
text={T}: Add {C}{C} to your mana pool.
mana={5}
+13
View File
@@ -4863,6 +4863,19 @@ public:
};
//AAttackSetCost
class AAttackSetCost: public MTGAbility
{
public:
string number;
AAttackSetCost(GameObserver* observer, int _id, MTGCardInstance * _source, string number);
void Update(float dt);
int addToGame();
int destroy();
const string getMenuText();
AAttackSetCost * clone() const;
};
//ABlink
class ABlink: public MTGAbility
{
+2
View File
@@ -216,6 +216,8 @@ public:
PAYZERO_COST = 33,
OVERLOAD_COST = 34,
BESTOW_COST = 35,
ATTACK_COST = 36,
ATTACKPLANESWALKER_COST = 37,
};
};
+3
View File
@@ -258,6 +258,9 @@ public:
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false);
int countTrini;
vector<MTGCardInstance*>imprintedCards;
int attackCost;
int attackCostBackup;
int attackPlaneswalkerCost;
int imprintG;
int imprintU;
int imprintR;
+3 -2
View File
@@ -244,8 +244,9 @@ class Constants
DEVOID = 123,
CANTCHANGELIFE = 124,
COMBATTOUGHNESS = 125,
CANTPAYLIFEORSACCREATURES = 126,
NB_BASIC_ABILITIES = 127,
CANTPAYLIFE = 126,
CANTBESACRIFIED = 127,
NB_BASIC_ABILITIES = 128,
RARITY_S = 'S', //Special Rarity
+12
View File
@@ -219,6 +219,18 @@ public:
virtual MTGSuspendRule * clone() const;
};
class MTGAttackCostRule: public PermanentAbility
{
public:
string scost;
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGAttackCostRule(GameObserver* observer, int _id);
const string getMenuText();
virtual MTGAttackCostRule * clone() const;
};
class MTGAttackRule: public PermanentAbility, public Limitor
{
public:
+45
View File
@@ -5371,6 +5371,51 @@ APhaseActionGeneric::~APhaseActionGeneric()
SAFE_DELETE(ability);
}
//AAttackSetCost
AAttackSetCost::AAttackSetCost(GameObserver* observer, int _id, MTGCardInstance * _source, string number) :
MTGAbility(observer, _id, _source), number(number)
{
}
void AAttackSetCost::Update(float dt)
{
if(game->getCurrentGamePhase() != MTG_PHASE_COMBATATTACKERS)
{
source->attackCost = source->attackCostBackup;
MTGAbility::Update(dt);
}
}
int AAttackSetCost::addToGame()
{
WParsedInt attackcost(number, NULL, source);
source->attackCost += attackcost.getValue();
source->attackCostBackup += attackcost.getValue();
return MTGAbility::addToGame();
}
int AAttackSetCost::destroy()
{
WParsedInt attackcost(number, NULL, source);
source->attackCost -= attackcost.getValue();
source->attackCostBackup -= attackcost.getValue();
return 1;
}
const string AAttackSetCost::getMenuText()
{
return "Attack Cost";
}
AAttackSetCost * AAttackSetCost::clone() const
{
return NEW AAttackSetCost(*this);
}
//a blink
ABlink::ABlink(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target, bool blinkueot, bool blinkForSource, bool blinkhand, MTGAbility * stored) :
MTGAbility(observer, _id, card),blinkueot(blinkueot),blinkForSource(blinkForSource),blinkhand(blinkhand),stored(stored)
+11 -19
View File
@@ -246,8 +246,8 @@ int LifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target->controller()->life <= 0 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) ||
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return 0;
}
@@ -286,8 +286,8 @@ int SpecificLifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life >= slc && !_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return 1;
}
@@ -336,15 +336,15 @@ int LifeorManaCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if ( _target->controller()->life <= 1 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) ||
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return _target->controller()->getManaPool()->canAfford(getManaCost());
}
else if((_target->controller()->life > 1 || _target->controller()->getManaPool()->canAfford(getManaCost())) &&
(!_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES)))
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE)))
{
return 1;
}
@@ -936,11 +936,8 @@ ExtraCost("Select creature to offer", _tc)
int Offering::canPay()
{
if(source->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
source->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
{
if (target && target->has(Constants::CANTBESACRIFIED))
return 0;
}
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
{
@@ -1001,13 +998,8 @@ SacrificeCost::SacrificeCost(TargetChooser *_tc)
int SacrificeCost::canPay()
{
if(source->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
source->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
{
if (target && target->isCreature())
return 0;
}
if (target && target->has(Constants::CANTBESACRIFIED))
return 0;
return 1;
}
+13
View File
@@ -1179,6 +1179,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
observer->addObserver(NEW MTGAttackRule(observer, -1));
return NULL;
}
//this rule handles attacking cost ability during attacker phase
found = s.find("attackcostrule");
if(found != string::npos)
{
observer->addObserver(NEW MTGAttackCostRule(observer, -1));
return NULL;
}
//this rule handles blocking ability during blocker phase
found = s.find("blockrule");
if(found != string::npos)
@@ -2829,6 +2836,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return NEW AReduceToAbility(observer, id, card,s.substr(9));
}
//attack cost
if (s.find("attackcost:") != string::npos)
{
return NEW AAttackSetCost(observer, id, card, s.substr(11));
}
//flanking
if (s.find("flanker") != string::npos)
{
+3
View File
@@ -209,6 +209,9 @@ void MTGCardInstance::initMTGCI()
miracle = false;
countTrini = 0;
imprintedCards.clear();
attackCost = 0;
attackCostBackup = 0;
attackPlaneswalkerCost = 0;
imprintG = 0;
imprintU = 0;
imprintR = 0;
+2 -1
View File
@@ -156,7 +156,8 @@ const char* Constants::MTGBasicAbilities[] = {
"devoid",
"cantchangelife",
"combattoughness",
"cantpaylifeorsaccreatures"
"cantpaylife",
"cantbesacrified"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+65 -3
View File
@@ -1348,12 +1348,74 @@ MTGOverloadRule * MTGOverloadRule::clone() const
///////////////////////////////////////////////////////////////////////////////////////////////////
MTGAttackCostRule::MTGAttackCostRule(GameObserver* observer, int _id) :
PermanentAbility(observer, _id)
{
aType = MTGAbility::ATTACK_COST;
scost = "Pay to attack";
}
int MTGAttackCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{
if (currentPhase == MTG_PHASE_COMBATATTACKERS && card->controller() == game->currentPlayer && card->controller() == game->currentlyActing())//on my turn and when I am the acting player.
{
if(card->isPhased)
return 0;
if(card->attackCost < 1)
return 0;
ManaCost * playerMana = card->controller()->getManaPool();
ManaCost * attackcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
attackcost->add(0,card->attackCostBackup);
if(attackcost->extraCosts)
for(unsigned int i = 0; i < attackcost->extraCosts->costs.size();i++)
{
attackcost->extraCosts->costs[i]->setSource(card);
}
scost = attackcost->getConvertedCost();
if (playerMana->canAfford(attackcost))
return 1;
}
return 0;
}
int MTGAttackCostRule::reactToClick(MTGCardInstance * card)
{
if (!isReactingToClick(card))
return 0;
Player * player = game->currentlyActing();
ManaCost * attackcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
attackcost->add(0,card->attackCostBackup);
ManaCost * playerMana = player->getManaPool();
playerMana->pay(attackcost);
card->attackCost = 0;
return 1;
}
ostream& MTGAttackCostRule::toString(ostream& out) const
{
out << "MTGAttackCostRule ::: (";
return MTGAbility::toString(out) << ")";
}
const string MTGAttackCostRule::getMenuText()
{
sprintf(menuText, "Pay to attack");
return menuText;
}
MTGAttackCostRule * MTGAttackCostRule::clone() const
{
return NEW MTGAttackCostRule(*this);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
bool MTGAttackRule::select(Target* t)
{
if (CardView* c = dynamic_cast<CardView*>(t))
{
MTGCardInstance * card = c->getCard();
if (card->canAttack() && !card->isPhased)
if (card->canAttack() && !card->isPhased && card->attackCost < 1)
return true;
}
return false;
@@ -1377,7 +1439,7 @@ int MTGAttackRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
return 0;
if (card->isAttacker())
return 1;
if (card->canAttack())
if (card->canAttack() && card->attackCost < 1)
return 1;
}
return 0;
@@ -1453,7 +1515,7 @@ int MTGPlaneswalkerAttackRule::isReactingToClick(MTGCardInstance * card, ManaCos
return 0;
if (card->isAttacker())
return 1;
if (card->canAttack())
if (card->canAttack() && card->attackPlaneswalkerCost < 1)
return 1;
}
return 0;