- Fixed Shadow Ability now works properly
- Added Generic KirdApe give P/W modifier when cards inplay - Added Rampage (WIP) does not work at the moment - Added Cards from diverse Sets
This commit is contained in:
+147
-147
@@ -2,150 +2,150 @@
|
||||
* Wagic, The Homebrew ?! is licensed under the BSD license
|
||||
* See LICENSE in the Folder's root
|
||||
* http://wololo.net/wagic/
|
||||
*/
|
||||
|
||||
#ifndef _SPELLSTACK_H_
|
||||
#define _SPELLSTACK_H_
|
||||
|
||||
#define MAX_SPELL_TARGETS 10
|
||||
|
||||
|
||||
#define ACTION_SPELL 10
|
||||
#define ACTION_DAMAGE 11
|
||||
#define ACTION_DAMAGES 12
|
||||
#define ACTION_NEXTGAMEPHASE 13
|
||||
#define ACTION_DRAW 14
|
||||
#define ACTION_PUTINGRAVEYARD 15
|
||||
#define ACTION_ABILITY 16
|
||||
|
||||
#define NOT_RESOLVED -2
|
||||
#define RESOLVED_OK 1
|
||||
#define RESOLVED_NOK -1
|
||||
|
||||
#include "../include/PlayGuiObject.h"
|
||||
#include "GuiLayers.h"
|
||||
#include "../include/TargetsList.h"
|
||||
#include "../include/Targetable.h"
|
||||
|
||||
class GuiLayer;
|
||||
class PlayGuiObject;
|
||||
class MTGCardInstance;
|
||||
class GameObserver;
|
||||
class Player;
|
||||
class Damageable;
|
||||
class MTGAbility;
|
||||
class Targetable;
|
||||
class DamageStack;
|
||||
class ManaCost;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable{
|
||||
public:
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering(){mHasFocus = true;};
|
||||
virtual bool Leaving(u32 key){mHasFocus = false;return true;};
|
||||
virtual bool ButtonPressed(){return true;};
|
||||
virtual int resolve(){return 0;};
|
||||
virtual void Render(){};
|
||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||
Interruptible(int id,bool hasFocus = false):PlayGuiObject(id,40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||
};
|
||||
|
||||
class NextGamePhase: public Interruptible {
|
||||
public:
|
||||
int resolve();
|
||||
void Render();
|
||||
NextGamePhase(int id);
|
||||
};
|
||||
|
||||
class Spell: public Interruptible, public TargetsList {
|
||||
protected:
|
||||
|
||||
public:
|
||||
ManaCost * cost;
|
||||
Spell(MTGCardInstance* _source);
|
||||
Spell(int id, MTGCardInstance* _source, Targetable * _targets[], int _nbtargets, ManaCost * _cost);
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
};
|
||||
|
||||
class StackAbility: public Interruptible {
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
};
|
||||
|
||||
class PutInGraveyard: public Interruptible {
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
void Render();
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
};
|
||||
|
||||
|
||||
class DrawAction: public Interruptible {
|
||||
public:
|
||||
int nbcards;
|
||||
Player * player;
|
||||
int resolve();
|
||||
void Render();
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
};
|
||||
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
int interruptDecision[2];
|
||||
int timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
int checked;
|
||||
|
||||
|
||||
void unpackDamageStacks();
|
||||
void unpackDamageStack(DamageStack * ds);
|
||||
void repackDamageStacks();
|
||||
public:
|
||||
int setIsInterrupting(Player * player);
|
||||
int count( int type = 0 , int state = 0 , int display = -1);
|
||||
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
void Fizzle(Interruptible * action);
|
||||
Interruptible * _(int id);
|
||||
void cancelInterruptOffer(int cancelMode = 1);
|
||||
void endOfInterruption();
|
||||
Interruptible * getLatest(int state);
|
||||
Player * askIfWishesToInterrupt;
|
||||
int garbageCollect();
|
||||
int addAction(Interruptible * interruptible);
|
||||
int addSpell(MTGCardInstance* card, Targetable * targets[], int nbtargets, ManaCost * mana);
|
||||
int AddNextGamePhase();
|
||||
int addPutInGraveyard(MTGCardInstance * card);
|
||||
int addDraw(Player * player, int nbcards = 1);
|
||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||
int addAbility(MTGAbility * ability);
|
||||
void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
virtual void Render();
|
||||
ActionStack(int id, GameObserver* _game);
|
||||
int resolve();
|
||||
int CombatDamages();
|
||||
int CombatDamages(int firststrike);
|
||||
int has(Interruptible * action);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef _SPELLSTACK_H_
|
||||
#define _SPELLSTACK_H_
|
||||
|
||||
#define MAX_SPELL_TARGETS 10
|
||||
|
||||
|
||||
#define ACTION_SPELL 10
|
||||
#define ACTION_DAMAGE 11
|
||||
#define ACTION_DAMAGES 12
|
||||
#define ACTION_NEXTGAMEPHASE 13
|
||||
#define ACTION_DRAW 14
|
||||
#define ACTION_PUTINGRAVEYARD 15
|
||||
#define ACTION_ABILITY 16
|
||||
|
||||
#define NOT_RESOLVED -2
|
||||
#define RESOLVED_OK 1
|
||||
#define RESOLVED_NOK -1
|
||||
|
||||
#include "../include/PlayGuiObject.h"
|
||||
#include "GuiLayers.h"
|
||||
#include "../include/TargetsList.h"
|
||||
#include "../include/Targetable.h"
|
||||
|
||||
class GuiLayer;
|
||||
class PlayGuiObject;
|
||||
class MTGCardInstance;
|
||||
class GameObserver;
|
||||
class Player;
|
||||
class Damageable;
|
||||
class MTGAbility;
|
||||
class Targetable;
|
||||
class DamageStack;
|
||||
class ManaCost;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable{
|
||||
public:
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering(){mHasFocus = true;};
|
||||
virtual bool Leaving(u32 key){mHasFocus = false;return true;};
|
||||
virtual bool ButtonPressed(){return true;};
|
||||
virtual int resolve(){return 0;};
|
||||
virtual void Render(){};
|
||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||
Interruptible(int id,bool hasFocus = false):PlayGuiObject(id,40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||
};
|
||||
|
||||
class NextGamePhase: public Interruptible {
|
||||
public:
|
||||
int resolve();
|
||||
void Render();
|
||||
NextGamePhase(int id);
|
||||
};
|
||||
|
||||
class Spell: public Interruptible, public TargetsList {
|
||||
protected:
|
||||
|
||||
public:
|
||||
ManaCost * cost;
|
||||
Spell(MTGCardInstance* _source);
|
||||
Spell(int id, MTGCardInstance* _source, Targetable * _targets[], int _nbtargets, ManaCost * _cost);
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
};
|
||||
|
||||
class StackAbility: public Interruptible {
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
};
|
||||
|
||||
class PutInGraveyard: public Interruptible {
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
void Render();
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
};
|
||||
|
||||
|
||||
class DrawAction: public Interruptible {
|
||||
public:
|
||||
int nbcards;
|
||||
Player * player;
|
||||
int resolve();
|
||||
void Render();
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
};
|
||||
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
int interruptDecision[2];
|
||||
int timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
int checked;
|
||||
|
||||
|
||||
void unpackDamageStacks();
|
||||
void unpackDamageStack(DamageStack * ds);
|
||||
void repackDamageStacks();
|
||||
public:
|
||||
int setIsInterrupting(Player * player);
|
||||
int count( int type = 0 , int state = 0 , int display = -1);
|
||||
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
void Fizzle(Interruptible * action);
|
||||
Interruptible * _(int id);
|
||||
void cancelInterruptOffer(int cancelMode = 1);
|
||||
void endOfInterruption();
|
||||
Interruptible * getLatest(int state);
|
||||
Player * askIfWishesToInterrupt;
|
||||
int garbageCollect();
|
||||
int addAction(Interruptible * interruptible);
|
||||
int addSpell(MTGCardInstance* card, Targetable * targets[], int nbtargets, ManaCost * mana);
|
||||
int AddNextGamePhase();
|
||||
int addPutInGraveyard(MTGCardInstance * card);
|
||||
int addDraw(Player * player, int nbcards = 1);
|
||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||
int addAbility(MTGAbility * ability);
|
||||
void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
virtual void Render();
|
||||
ActionStack(int id, GameObserver* _game);
|
||||
int resolve();
|
||||
int CombatDamages();
|
||||
int CombatDamages(int firststrike);
|
||||
int has(Interruptible * action);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2715,7 +2715,6 @@ public:
|
||||
};
|
||||
|
||||
// GiveLifeForTappedType
|
||||
|
||||
class AGiveLifeForTappedType:public MTGAbility{
|
||||
public:
|
||||
char type[20];
|
||||
@@ -2746,6 +2745,67 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// People of the Woods
|
||||
class APeopleOfTheWoods:public ListMaintainerAbility{
|
||||
public:
|
||||
APeopleOfTheWoods(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (source->controller()->game->inPlay->hasCard(card) && card->hasType("forest") ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int added(MTGCardInstance * card){
|
||||
source->addToToughness(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int removed(MTGCardInstance * card){
|
||||
source->addToToughness(-1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Abomination Kill blocking creature if white or green
|
||||
class AAbomination :public MTGAbility{
|
||||
public:
|
||||
MTGCardInstance * opponents[20];
|
||||
int nbOpponents;
|
||||
AAbomination (int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
|
||||
nbOpponents = 0;
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase){
|
||||
if( newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
nbOpponents = 0;
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
while (opponent && opponent->hasColor(MTG_COLOR_GREEN) || opponent->hasColor(MTG_COLOR_WHITE)){
|
||||
opponents[nbOpponents] = opponent;
|
||||
nbOpponents ++;
|
||||
opponent = source->getNextOpponent(opponent);
|
||||
}
|
||||
}else if (newPhase == MTG_PHASE_COMBATEND){
|
||||
for (int i = 0; i < nbOpponents ; i++){
|
||||
game->mLayers->stackLayer()->addPutInGraveyard(opponents[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if(!game->isInPlay(source) && currentPhase != MTG_PHASE_UNTAP){
|
||||
return 0;
|
||||
}else{
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//Minion of Leshrac
|
||||
class AMinionofLeshrac: public TargetAbility{
|
||||
public:
|
||||
@@ -2808,5 +2868,114 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//CreaturePowerToughnessModifierForAllTypeControlled
|
||||
class ACreaturePowerToughnessModifierForAllTypeControlled:public ListMaintainerAbility{
|
||||
public:
|
||||
char type[20];
|
||||
ACreaturePowerToughnessModifierForAllTypeControlled(int _id, MTGCardInstance * _source, const char * _type):ListMaintainerAbility(_id, _source){
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (source->controller()->game->inPlay->hasCard(card) && card->hasType(type) ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int added(MTGCardInstance * card){
|
||||
source->power += 1;
|
||||
source->addToToughness(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int removed(MTGCardInstance * card){
|
||||
source->power -= 1;
|
||||
source->addToToughness(-1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//GenericKirdApe
|
||||
class AGenericKirdApe:public MTGAbility{
|
||||
public:
|
||||
int init;
|
||||
char type [20];
|
||||
int power;
|
||||
int toughness;
|
||||
AGenericKirdApe(int _id, MTGCardInstance * _source, const char * _type, int _power, int _toughness):MTGAbility(_id, _source){
|
||||
init = 0;
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (source->controller()->game->inPlay->hasType(type)){
|
||||
if(!init){
|
||||
init = 1;
|
||||
source->power+=power;
|
||||
source->addToToughness(toughness);
|
||||
}
|
||||
}else{
|
||||
if (init){
|
||||
init = 0;
|
||||
source->power-=power;
|
||||
source->addToToughness(-toughness);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Rampage ability Tentative 2
|
||||
class ARampageAbility:public MTGAbility{
|
||||
public:
|
||||
int nbOpponents;
|
||||
int PowerModifier;
|
||||
int ToughnessModifier;
|
||||
int modifier;
|
||||
ARampageAbility(int _id, MTGCardInstance * _source,int _PowerModifier, int _ToughnessModifier):MTGAbility(_id, _source){
|
||||
modifier=0;
|
||||
}
|
||||
void Update(float dt){
|
||||
if (source->isAttacker()){
|
||||
MTGInPlay * inPlay = game->opponent()->game->inPlay;
|
||||
for (int i = 0; i < inPlay->nb_cards; i ++){
|
||||
MTGCardInstance * current = inPlay->cards[i];
|
||||
if (current->isDefenser()){
|
||||
modifier++;
|
||||
}
|
||||
}
|
||||
source->power+= (PowerModifier * modifier);
|
||||
source->addToToughness(ToughnessModifier * modifier);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Rampage ability Tentative 1 - Did not work as expected
|
||||
class A1RampageAbility:public MTGAbility{
|
||||
public:
|
||||
MTGCardInstance * opponents[20];
|
||||
int nbOpponents;
|
||||
int PowerModifier;
|
||||
int ToughnessModifier;
|
||||
A1RampageAbility(int _id, MTGCardInstance * _source,int _PowerModifier, int _ToughnessModifier):MTGAbility(_id, _source){
|
||||
nbOpponents = 0;
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (source->isAttacker()){
|
||||
if (newPhase != currentPhase){
|
||||
if( newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
nbOpponents = 0;
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
while (opponent){
|
||||
opponents[nbOpponents] = opponent;
|
||||
nbOpponents ++;
|
||||
source->power+= PowerModifier;
|
||||
source->addToToughness(ToughnessModifier);
|
||||
opponent = source->getNextOpponent(opponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -93,8 +93,10 @@ static int _b[7] = {20, 0, 140,15, 50,255,128};
|
||||
#define MOUNTAINHOME 33
|
||||
#define SWAMPHOME 34
|
||||
#define PLAINSHOME 35
|
||||
#define FLANKING 36
|
||||
#define RAMPAGE1 37
|
||||
|
||||
#define NB_BASIC_ABILITIES 36
|
||||
#define NB_BASIC_ABILITIES 38
|
||||
|
||||
static const char * MTGBasicAbilities[] = {
|
||||
"trample",
|
||||
@@ -132,7 +134,9 @@ static const char * MTGBasicAbilities[] = {
|
||||
"islandhome",
|
||||
"moutainhome",
|
||||
"swamphome",
|
||||
"plainshome"
|
||||
"plainshome",
|
||||
"flanking",
|
||||
"rampage",
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user