Erwan
- fixed issue 267 (hope charm) - fixed an issue in which the core Rules where not correctly loaded for the test suite
This commit is contained in:
@@ -242,6 +242,7 @@ harpoon_sniper.txt
|
|||||||
hellfire.txt
|
hellfire.txt
|
||||||
helm_of_kaldra1.txt
|
helm_of_kaldra1.txt
|
||||||
holy_day_i226.txt
|
holy_day_i226.txt
|
||||||
|
hope_charm_i267.txt
|
||||||
hopping_automaton_i232.txt
|
hopping_automaton_i232.txt
|
||||||
horned_helm.txt
|
horned_helm.txt
|
||||||
howl_from_beyond.txt
|
howl_from_beyond.txt
|
||||||
|
|||||||
@@ -899,6 +899,11 @@ class ABasicAbilityModifierUntilEOT:public TargetAbility{
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int addToGame(){
|
||||||
|
resolve();
|
||||||
|
return ActivatedAbility::addToGame();
|
||||||
|
}
|
||||||
|
|
||||||
const char * getMenuText(){
|
const char * getMenuText(){
|
||||||
return Constants::MTGBasicAbilities[ability];
|
return Constants::MTGBasicAbilities[ability];
|
||||||
}
|
}
|
||||||
@@ -973,6 +978,11 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
|
|||||||
ability = NEW AInstantBasicAbilityModifierUntilEOT(_id,_source,_target,_ability, _value);
|
ability = NEW AInstantBasicAbilityModifierUntilEOT(_id,_source,_target,_ability, _value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isReactingToClick(MTGCardInstance * card, ManaCost * cost = NULL){
|
||||||
|
//The upper level "GenericTargetAbility" takes care of the click so we always return 0 here
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int resolve(){
|
int resolve(){
|
||||||
MTGAbility * a = ability->clone();
|
MTGAbility * a = ability->clone();
|
||||||
a->target = target;
|
a->target = target;
|
||||||
@@ -980,6 +990,11 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int addToGame(){
|
||||||
|
resolve();
|
||||||
|
return ActivatedAbility::addToGame();
|
||||||
|
}
|
||||||
|
|
||||||
const char * getMenuText(){
|
const char * getMenuText(){
|
||||||
return ability->getMenuText();
|
return ability->getMenuText();
|
||||||
}
|
}
|
||||||
@@ -1266,58 +1281,6 @@ class APowerToughnessModifier: public MTGAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Alteration of Power and Toughness until end of turn (TargetAbility)
|
|
||||||
// Gives +n/+m until end of turn to any card that's a target
|
|
||||||
class ATargetterPowerToughnessModifierUntilEOT: public TargetAbility{
|
|
||||||
public:
|
|
||||||
MTGCardInstance * mTargets[50];
|
|
||||||
int nbTargets;
|
|
||||||
WParsedPT * wppt;
|
|
||||||
|
|
||||||
ATargetterPowerToughnessModifierUntilEOT(int _id, MTGCardInstance * _source, WParsedPT * wppt, ManaCost * _cost, TargetChooser * _tc = NULL, int doTap=1):TargetAbility(_id,_source,_tc,_cost,0,doTap),wppt(wppt){
|
|
||||||
if (!tc) tc = NEW CreatureTargetChooser(_source);
|
|
||||||
nbTargets = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Update(float dt){
|
|
||||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
|
||||||
for (int i = 0; i < nbTargets; i++){
|
|
||||||
MTGCardInstance * mTarget = mTargets[i];
|
|
||||||
if(mTarget){
|
|
||||||
mTarget->power-=wppt->power.getValue();
|
|
||||||
mTarget->addToToughness(-wppt->toughness.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nbTargets = 0;
|
|
||||||
}
|
|
||||||
TargetAbility::Update(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int resolve(){
|
|
||||||
MTGCardInstance * mTarget = tc->getNextCardTarget();
|
|
||||||
if (mTarget){
|
|
||||||
mTargets[nbTargets] = mTarget;
|
|
||||||
mTarget->power+= wppt->power.getValue();
|
|
||||||
mTarget->addToToughness(wppt->toughness.getValue());
|
|
||||||
nbTargets++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ATargetterPowerToughnessModifierUntilEOT * clone() const{
|
|
||||||
ATargetterPowerToughnessModifierUntilEOT * a = NEW ATargetterPowerToughnessModifierUntilEOT(*this);
|
|
||||||
a->wppt = NEW WParsedPT(*(a->wppt));
|
|
||||||
a->isClone = 1;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
~ATargetterPowerToughnessModifierUntilEOT(){
|
|
||||||
delete(wppt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//Alteration of Power and toughness until end of turn (instant)
|
//Alteration of Power and toughness until end of turn (instant)
|
||||||
class AInstantPowerToughnessModifierUntilEOT: public InstantAbility{
|
class AInstantPowerToughnessModifierUntilEOT: public InstantAbility{
|
||||||
public:
|
public:
|
||||||
@@ -1369,6 +1332,11 @@ class APowerToughnessModifierUntilEndOfTurn: public ActivatedAbility{
|
|||||||
ability = NEW AInstantPowerToughnessModifierUntilEOT(id,_source,_target,wppt);
|
ability = NEW AInstantPowerToughnessModifierUntilEOT(id,_source,_target,wppt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isReactingToClick(MTGCardInstance * card, ManaCost * cost = NULL){
|
||||||
|
//The upper level "GenericTargetAbility" takes care of the click so we always return 0 here
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Update(float dt){
|
void Update(float dt){
|
||||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT){
|
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT){
|
||||||
counters = 0;
|
counters = 0;
|
||||||
@@ -1384,10 +1352,10 @@ class APowerToughnessModifierUntilEndOfTurn: public ActivatedAbility{
|
|||||||
return ability->getMenuText();
|
return ability->getMenuText();
|
||||||
}
|
}
|
||||||
|
|
||||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){
|
/* int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){
|
||||||
if (!ActivatedAbility::isReactingToClick(card,mana)) return 0;
|
if (!ActivatedAbility::isReactingToClick(card,mana)) return 0;
|
||||||
return (!maxcounters || (counters < maxcounters));
|
return (!maxcounters || (counters < maxcounters));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
int resolve(){
|
int resolve(){
|
||||||
MTGAbility * a = ability->clone();
|
MTGAbility * a = ability->clone();
|
||||||
@@ -1397,6 +1365,11 @@ class APowerToughnessModifierUntilEndOfTurn: public ActivatedAbility{
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int addToGame(){
|
||||||
|
resolve();
|
||||||
|
return ActivatedAbility::addToGame();
|
||||||
|
}
|
||||||
|
|
||||||
APowerToughnessModifierUntilEndOfTurn * clone() const{
|
APowerToughnessModifierUntilEndOfTurn * clone() const{
|
||||||
APowerToughnessModifierUntilEndOfTurn * a = NEW APowerToughnessModifierUntilEndOfTurn(*this);
|
APowerToughnessModifierUntilEndOfTurn * a = NEW APowerToughnessModifierUntilEndOfTurn(*this);
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
@@ -3355,6 +3328,11 @@ class ADragonWhelp: public APowerToughnessModifierUntilEndOfTurn{
|
|||||||
cost->add(Constants::MTG_COLOR_RED, 1);
|
cost->add(Constants::MTG_COLOR_RED, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){
|
||||||
|
if (!ActivatedAbility::isReactingToClick(card,mana)) return 0;
|
||||||
|
return (!maxcounters || (counters < maxcounters));
|
||||||
|
}
|
||||||
|
|
||||||
void Update(float dt){
|
void Update(float dt){
|
||||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT && counters > 3){
|
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT && counters > 3){
|
||||||
source->controller()->game->putInGraveyard(source);
|
source->controller()->game->putInGraveyard(source);
|
||||||
|
|||||||
@@ -232,9 +232,8 @@ void GameStateDuel::Update(float dt)
|
|||||||
#ifdef TESTSUITE
|
#ifdef TESTSUITE
|
||||||
else if (mParent->players[1] == PLAYER_TYPE_TESTSUITE){
|
else if (mParent->players[1] == PLAYER_TYPE_TESTSUITE){
|
||||||
if (testSuite && testSuite->loadNext()){
|
if (testSuite && testSuite->loadNext()){
|
||||||
|
|
||||||
loadTestSuitePlayers();
|
|
||||||
rules = NEW Rules("testsuite.txt");
|
rules = NEW Rules("testsuite.txt");
|
||||||
|
loadTestSuitePlayers();
|
||||||
mGamePhase = DUEL_STATE_PLAY;
|
mGamePhase = DUEL_STATE_PLAY;
|
||||||
testSuite->initGame();
|
testSuite->initGame();
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|||||||
@@ -1840,7 +1840,9 @@ int TargetAbility::resolve(){
|
|||||||
Targetable * t = tc->getNextTarget();
|
Targetable * t = tc->getNextTarget();
|
||||||
if (t && ability){
|
if (t && ability){
|
||||||
ability->target = t;
|
ability->target = t;
|
||||||
return ability->resolve();
|
if (ability->oneShot) return ability->resolve();
|
||||||
|
MTGAbility * a = ability->clone();
|
||||||
|
return a->addToGame();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user