- removed some unused code. Please review!
- Added protection from() auto keyword. It is still possible to use protection from [color] in abilities, but when it is not possible, please use protection from([target]) in auto=
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-21 07:26:26 +00:00
parent a7a3ecb596
commit da9a82cff4
33 changed files with 178 additions and 436 deletions

View File

@@ -24,7 +24,6 @@ class ActionLayer: public GuiLayer, public JGuiListener{
int stuffHappened;
virtual void Render();
virtual void Update(float dt);
int unstoppableRenderInProgress();
bool CheckUserInput(u32 key);
ActionLayer();
~ActionLayer();

View File

@@ -1034,6 +1034,38 @@ class AUnBlocker:public MTGAbility{
};
//Protection From (creature/aura)
class AProtectionFrom: public MTGAbility{
public:
TargetChooser * fromTc;
AProtectionFrom(int id, MTGCardInstance * _source, MTGCardInstance * _target, TargetChooser *fromTc):MTGAbility(id,_source,_target),fromTc(fromTc){
}
int addToGame(){
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->addProtection(fromTc);
return MTGAbility::addToGame();
}
int destroy(){
((MTGCardInstance *)target)->removeProtection(fromTc);
return 1;
}
AProtectionFrom * clone() const{
AProtectionFrom * a = NEW AProtectionFrom(*this);
a->isClone = 1;
return a;
}
~AProtectionFrom(){
SAFE_DELETE(fromTc);
}
};
//Alteration of Power and Toughness (enchantments)
class APowerToughnessModifier: public MTGAbility{
public:

View File

@@ -28,13 +28,6 @@ class CardDisplay:public PlayGuiObjectController{
};
class DefaultTargetDisplay:CardDisplay{
public:
DefaultTargetDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener, int nb_displayed_items );
~DefaultTargetDisplay();
};
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
#endif

View File

@@ -39,7 +39,6 @@ public:
void Render();
void Add(GuiLayer * layer);
void Remove();
int unstoppableRenderInProgress();
int receiveEvent(WEvent * e);
float RightBoundary();

View File

@@ -45,7 +45,6 @@ class GameObserver{
ReplacementEffects *replacementEffects;
Player * gameOver;
Player * players[2]; //created outside
MTGGamePhase * gamePhaseManager; //Created Outside ?
TargetChooser * getCurrentTargetChooser();
void stackObjectClicked(Interruptible * action);
@@ -67,7 +66,6 @@ class GameObserver{
Player * currentlyActing();
GameObserver(Player * _players[], int _nbplayers);
~GameObserver();
void setGamePhaseManager(MTGGamePhase * _phases);
void stateEffects();
void eventOccured();
void addObserver(MTGAbility * observer);
@@ -76,7 +74,6 @@ class GameObserver{
void untapPhase();
void draw();
int isInPlay(MTGCardInstance * card);
bool isCreature(MTGCardInstance * card);
void Update(float dt);
void Render();

View File

@@ -25,13 +25,10 @@ class GuiLayer{
bool hasFocus;
virtual void resetObjects();
int getMaxId();
void RenderMessageBackground(float x0, float y0, float width, int height);
void RenderMessageBackground(float y0, int height);
GuiLayer();
virtual ~GuiLayer();
virtual void Update(float dt);
virtual bool CheckUserInput(u32 key){ return false; };
virtual int unstoppableRenderInProgress(){return 0;};
int getIndexOf(JGuiObject * object);
JGuiObject * getByIndex (int index);
virtual void Render();

View File

@@ -211,7 +211,6 @@ class AbilityFactory{
int moveAll(TargetChooser * tc, string destinationZone);
int damageAll(TargetChooser * tc, int damage);
int TapAll(TargetChooser * tc);
int CantBlock(TargetChooser * tc);
int UntapAll(TargetChooser * tc);
void addAbilities(int _id, Spell * spell);
};

View File

@@ -42,7 +42,6 @@ class MTGCard {
int power;
int toughness;
int setId;
static const char * const Colors_To_Text[];
int nb_types;
int types[MAX_TYPES_PER_CARD];
MTGCard();
@@ -55,7 +54,6 @@ class MTGCard {
int getColor();
int hasColor(int _color);
int countColors();
const char * colorToString();
void setMTGId(int id);
int getMTGId();

View File

@@ -35,7 +35,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
UntapBlockers * untapBlockers;
MTGPlayerCards * belongs_to;
MTGAbility * untapBlockerAbilities[10];
void unband();
MTGCardInstance * getNextPartner();
void initMTGCI();
int setDefenser(MTGCardInstance * c);
@@ -81,7 +80,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
int attacker;
int toggleDefenser(MTGCardInstance * opponent);
int raiseBlockerRankOrder(MTGCardInstance * blocker);
int bringBlockerToFrontOfOrder(MTGCardInstance * blocker);
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
int getDefenserRank(MTGCardInstance * blocker);
@@ -94,7 +92,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
MTGCardInstance * isDefenser();
int initAttackersDefensers();
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
MTGCardInstance * getNextDefenser(MTGCardInstance * previous=NULL);
int nbOpponents();
int stepPower(CombatStep step);
@@ -102,8 +99,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
int has(int ability);
int cleanup();
int reset();
MTGCard * model;
MTGCardInstance();
@@ -121,13 +116,12 @@ class MTGCardInstance: public MTGCard, public Damageable {
int addToToughness(int value);
int setToughness(int value);
CardDescriptor * protections[10];
int nbprotections;
int addProtection(CardDescriptor * cd);
int removeProtection(CardDescriptor *cd, int erase = 0);
vector<TargetChooser *>protections;
int addProtection(TargetChooser * tc);
int removeProtection(TargetChooser *tc, int erase = 0);
int protectedAgainst(MTGCardInstance * card);
void copy(MTGCardInstance * card);
// in game
void setUntapping();
int isUntapping();
@@ -137,7 +131,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
void attemptUntap();
int isInPlay();
void resetAllDamage();
JSample * getSample();
JQuad * getIcon();

View File

@@ -93,7 +93,6 @@ class MTGGameZone {
class MTGLibrary: public MTGGameZone {
public:
// MTGLibrary();
void shuffleTopToBottom(int nbcards);
MTGCardInstance * draw();
virtual ostream& toString(ostream&) const;
@@ -102,7 +101,6 @@ class MTGLibrary: public MTGGameZone {
class MTGGraveyard: public MTGGameZone {
public:
// MTGGraveyard();
virtual ostream& toString(ostream&) const;
const char * getName(){return "graveyard";}
};
@@ -127,12 +125,8 @@ class MTGStack: public MTGGameZone {
class MTGInPlay: public MTGGameZone {
public:
//MTGInPlay();
void untapAll();
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
MTGCardInstance * getNextDefenser(MTGCardInstance * previous, MTGCardInstance * attacker);
int nbDefensers( MTGCardInstance * attacker);
int nbPartners(MTGCardInstance * attacker);
virtual ostream& toString(ostream&) const;
const char * getName(){return "battlefield";}
};

View File

@@ -41,7 +41,6 @@ class ManaCost{
int getCost(int color);
//Returns NULL if i is greater than nbhybrids
ManaCostHybrid * getHybridCost(unsigned int i);
int getMainColor();
int hasColor(int color);
int remove (int color, int value);
int add(int color, int value);
@@ -52,7 +51,6 @@ class ManaCost{
int addExtraCost(ExtraCost * _cost);
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
int isExtraPaymentSet();
int resetExtraPayment();
int doPayExtra();
int addHybrid(int c1, int v1, int c2, int v2);

View File

@@ -261,23 +261,6 @@ protected:
JGuiListener * mListener;
};
class WGuiImage: public WGuiItem{
public:
WGuiImage(string _file, int _w, int _h, int _margin);
virtual bool Selectable() {return false;};
virtual JQuad * getImage();
virtual void Render();
virtual float getHeight();
virtual void imageScale(float w, float h);
protected:
bool exact;
int margin;
int imgW, imgH;
string filename;
};
class WGuiText:public WGuiItem {
public:
WGuiText(string _displayValue): WGuiItem(_displayValue) {};
@@ -376,19 +359,6 @@ class OptionInteger:public OptionItem{
virtual void updateValue(){value+=increment; if (value>maxValue) value=0;};
};
class OptionString:public OptionItem{
public:
string value;
OptionString(int _id, string _displayValue);
virtual void Render();
virtual void setData();
virtual void updateValue();
virtual bool Changed() {return value != options[id].str;};
virtual void Reload() {if(id != INVALID_OPTION) value = options[id].str;};
bool bShowValue;
};
class OptionSelect:public OptionItem{
public:
size_t value;

View File

@@ -42,6 +42,8 @@ class TargetChooser: public TargetsList {
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
int maxtargets; //Set to -1 for "unlimited"
virtual int setAllZones(){return 0;}
virtual bool targetsZone(MTGGameZone * z){return false;};
int ForceTargetListReady();
int targetsReadyCheck();
@@ -65,13 +67,14 @@ class TargetChooserFactory{
class TargetZoneChooser:public TargetChooser{
public:
int zones[10];
int zones[15];
int nbzones;
int init(int * _zones, int _nbzones);
bool targetsZone(MTGGameZone * z);
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * _card);
int setAllZones();
};
class CardTargetChooser:public TargetZoneChooser {
@@ -155,10 +158,5 @@ class DamageTargetChooser:public TargetChooser{
virtual bool canTarget(Targetable * target);
};
class DamageOrPermanentTargetChooser:public TargetZoneChooser{
public:
int color;
DamageOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * target);
};
#endif