- Parser: Added possibility to add multiple abilities for one cost, using keyword && (see Ardakar wastes in 10E). Currently only works with mana and damage
- Added a dozen new cards
- Improved testing suite : new keyword "choice" to select an item in the abilities popup menu
This commit is contained in:
wagic.the.homebrew
2009-01-18 06:42:59 +00:00
parent e978a7d168
commit 9e314720e9
15 changed files with 723 additions and 546 deletions
+1
View File
@@ -30,6 +30,7 @@ class ActionLayer: public GuiLayer, public JGuiListener{
int reactToClick(MTGCardInstance * card);
void setMenuObject(Targetable * object);
void ButtonPressed(int controllerid, int controlid);
void doReactTo(int menuIndex);
TargetChooser * getCurrentTargetChooser();
};
+53 -2
View File
@@ -23,6 +23,51 @@ using std::map;
*/
//MultiAbility : triggers several actions for a cost
class MultiAbility:public ActivatedAbility{
public:
vector<MTGAbility *> abilities;
vector<TriggeredEvent *> events;
MultiAbility(int _id, MTGCardInstance * card,ManaCost * _cost, int _tap):ActivatedAbility(_id, card,_cost,0,_tap){
}
int Add(TriggeredEvent * event){
events.push_back(event);
return 1;
}
int Add(MTGAbility * ability){
abilities.push_back(ability);
return 1;
}
int resolve(){
vector<int>::size_type sz = abilities.size();
for (unsigned int i = 0; i < sz; i++){
abilities[i]->resolve();
}
sz = events.size();
for (unsigned int i = 0; i < sz; i++){
events[i]->resolve();
}
return 1;
}
~MultiAbility(){
vector<int>::size_type sz = abilities.size();
for (unsigned int i = 0; i < sz; i++){
delete abilities[i];
}
sz = events.size();
for (unsigned int i = 0; i < sz; i++){
delete events[i];
}
}
};
//Drawer, allows to draw a card for a cost:
class ADrawer:public ActivatedAbility{
@@ -627,7 +672,7 @@ class AManaProducer: public MTGAbility{
if (animation < 0){
animation = 0;
currentlyTapping--;
controller->getManaPool()->add(output);
resolve();
if (mParticleSys) mParticleSys->Stop();
}
}
@@ -653,6 +698,12 @@ class AManaProducer: public MTGAbility{
return result;
}
int resolve(){
controller = source->controller();
controller->getManaPool()->add(output);
return 1;
}
int reactToClick(MTGCardInstance * _card){
if (!isReactingToClick( _card)) return 0;
source->tapped = 1;
@@ -664,7 +715,7 @@ class AManaProducer: public MTGAbility{
x0 = cardg->x + 15;
y0 = cardg->y + 20;
}
controller = source->controller();
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME] > 0 && currentlyTapping < 3){
JSample * sample = SampleCache::GetInstance()->getSample("sound/sfx/mana.wav");
+12
View File
@@ -147,6 +147,8 @@ class TriggerNextPhase:public TriggerAtPhase{
class TriggeredEvent:public MTGAbilityBasicFeatures{
public:
TriggeredEvent();
TriggeredEvent(MTGCardInstance * source, Damageable * target = NULL);
virtual int resolve()=0;
};
@@ -163,6 +165,15 @@ class BuryEvent: public TriggeredEvent{
int resolve();
};
class DamageEvent:public TriggeredEvent{
public:
int damage;
DamageEvent(MTGCardInstance * _source, Damageable * _target, int _damage);
int resolve();
};
class DestroyCondition:public MTGAbilityBasicFeatures{
public:
virtual int testDestroy();
@@ -189,6 +200,7 @@ class AbilityFactory{
int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p);
int parsePowerToughness(string s, int *power, int *toughness);
Trigger * parseTrigger(string magicText);
Damageable * parseCollateralTarget(MTGCardInstance * card, string s);
public:
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL);
void addAbilities(int _id, Spell * spell);
+2
View File
@@ -3,6 +3,8 @@
#if defined (WIN32) || defined (LINUX)
#define TESTSUITE 1
#else
#define OutputDebugString(val) {}
#endif
#if defined (_DEBUG) && defined (WIN32)