ERwan
-fix issue 297 - also removed the "untapBlockers" system. The idea was nice but incorrectly implemented, and only 2 cards were using it so far.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIStats.o objs/Blocker.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/ConstraintResolver.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/Pos.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/ShopItem.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/SimplePad.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/Token.o objs/Translate.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/Tasks.o
|
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIStats.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/Pos.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/ShopItem.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/SimplePad.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/Token.o objs/Translate.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/Tasks.o
|
||||||
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
||||||
|
|
||||||
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
||||||
|
|||||||
@@ -1408,6 +1408,8 @@ type=Instant
|
|||||||
text=Mana Vault doesn't untap during your untap step. At the beginning of your upkeep, you may pay {4}. If you do, untap Mana Vault. At the beginning of your draw step, if Mana Vault is tapped, it deals 1 damage to you. {T}: Add {3} to your mana pool.
|
text=Mana Vault doesn't untap during your untap step. At the beginning of your upkeep, you may pay {4}. If you do, untap Mana Vault. At the beginning of your draw step, if Mana Vault is tapped, it deals 1 damage to you. {T}: Add {3} to your mana pool.
|
||||||
id=1124
|
id=1124
|
||||||
name=Mana Vault
|
name=Mana Vault
|
||||||
|
auto=doesnotuntap
|
||||||
|
auto={4}:untap myUpkeepOnly
|
||||||
rarity=R
|
rarity=R
|
||||||
mana={1}
|
mana={1}
|
||||||
type=Artifact
|
type=Artifact
|
||||||
@@ -1581,6 +1583,9 @@ text=Enchant creature When Paralyze enters the battlefield, tap enchanted crea
|
|||||||
target=creature
|
target=creature
|
||||||
id=1171
|
id=1171
|
||||||
name=Paralyze
|
name=Paralyze
|
||||||
|
auto=tap
|
||||||
|
auto=doesnotuntap
|
||||||
|
auto={4}:untap upkeepOlny
|
||||||
rarity=C
|
rarity=C
|
||||||
mana={B}
|
mana={B}
|
||||||
type=Enchantment
|
type=Enchantment
|
||||||
|
|||||||
@@ -1405,27 +1405,6 @@ class GenericInstantAbility: public InstantAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Untap Blockers with simple Mana Mechanism
|
|
||||||
class AUntapManaBlocker: public UntapBlocker{
|
|
||||||
public:
|
|
||||||
AUntapManaBlocker(int id, MTGCardInstance * card, ManaCost * _cost):UntapBlocker(id, card, _cost){
|
|
||||||
}
|
|
||||||
|
|
||||||
AUntapManaBlocker(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost):UntapBlocker(id, card,_target, _cost){
|
|
||||||
}
|
|
||||||
virtual ostream& toString(ostream& out) const
|
|
||||||
{
|
|
||||||
out << "AUntapManaBlocker ::: (";
|
|
||||||
return UntapBlocker::toString(out) << ")";
|
|
||||||
}
|
|
||||||
AUntapManaBlocker * clone() const{
|
|
||||||
AUntapManaBlocker * a = NEW AUntapManaBlocker(*this);
|
|
||||||
a->isClone = 1;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//Circle of Protections
|
//Circle of Protections
|
||||||
class ACircleOfProtection: public TargetAbility{
|
class ACircleOfProtection: public TargetAbility{
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#ifndef _BLOCKER_H_
|
|
||||||
#define _BLOCKER_H_
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_BLOCKERS 64 // Currently needs to be equal to MAX_GUI_OBJECTS in JGE/JGui.h.
|
|
||||||
|
|
||||||
|
|
||||||
#include "MTGAbility.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ManaCost;
|
|
||||||
class GameObserver;
|
|
||||||
class MTGAbility;
|
|
||||||
|
|
||||||
class UntapBlocker : public MTGAbility {
|
|
||||||
protected:
|
|
||||||
ManaCost * manaCost;
|
|
||||||
int currentPhase;
|
|
||||||
void init(ManaCost * _cost);
|
|
||||||
public:
|
|
||||||
virtual ManaCost * untapManaCost(){return manaCost;};
|
|
||||||
virtual int unblock(){return 1;};
|
|
||||||
UntapBlocker(int id, MTGCardInstance * card, ManaCost * _cost);
|
|
||||||
UntapBlocker(int id, MTGCardInstance * card);
|
|
||||||
UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target);
|
|
||||||
UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target, ManaCost * _cost);
|
|
||||||
~UntapBlocker();
|
|
||||||
virtual void Update(float dt);
|
|
||||||
virtual int destroy();
|
|
||||||
virtual UntapBlocker * clone() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class UntapBlockers {
|
|
||||||
protected:
|
|
||||||
int cursor;
|
|
||||||
int blockers[MAX_BLOCKERS];
|
|
||||||
GameObserver * game;
|
|
||||||
public:
|
|
||||||
UntapBlockers();
|
|
||||||
~UntapBlockers();
|
|
||||||
int Add (UntapBlocker * ability);
|
|
||||||
int Remove (UntapBlocker * ability);
|
|
||||||
int init();
|
|
||||||
UntapBlocker * next();
|
|
||||||
int rewind();
|
|
||||||
int isEmpty();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#include "ManaCost.h"
|
|
||||||
#include "GameObserver.h"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef _CONSTRAINTRESOLVER_H_
|
|
||||||
#define _CONSTRAINTRESOLVER_H_
|
|
||||||
|
|
||||||
#include "GameObserver.h"
|
|
||||||
#include "MTGCardInstance.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ConstraintResolver {
|
|
||||||
protected:
|
|
||||||
public:
|
|
||||||
static int untap(GameObserver * game, MTGCardInstance * card);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -31,6 +31,7 @@ class GameObserver{
|
|||||||
|
|
||||||
int nbPlayers;
|
int nbPlayers;
|
||||||
int currentPlayerId;
|
int currentPlayerId;
|
||||||
|
int untap(MTGCardInstance * card);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CombatStep combatStep;
|
CombatStep combatStep;
|
||||||
|
|||||||
@@ -119,6 +119,38 @@ class ActivatedAbility:public MTGAbility{
|
|||||||
MY_EOT = 15,
|
MY_EOT = 15,
|
||||||
MY_CLEANUP = 16,
|
MY_CLEANUP = 16,
|
||||||
MY_AFTER_EOT = 17,
|
MY_AFTER_EOT = 17,
|
||||||
|
|
||||||
|
OPPONENT_BEFORE_BEGIN = 23,
|
||||||
|
OPPONENT_UNTAP = 24,
|
||||||
|
OPPONENT_UPKEEP = 25,
|
||||||
|
OPPONENT_DRAW = 26,
|
||||||
|
OPPONENT_FIRSTMAIN = 27,
|
||||||
|
OPPONENT_COMBATBEGIN = 28,
|
||||||
|
OPPONENT_COMBATATTACKERS = 29,
|
||||||
|
OPPONENT_COMBATBLOCKERS = 30,
|
||||||
|
OPPONENT_COMBATDAMAGE = 31,
|
||||||
|
OPPONENT_COMBATEND = 32,
|
||||||
|
OPPONENT_SECONDMAIN = 33,
|
||||||
|
OPPONENT_ENDOFTURN = 34,
|
||||||
|
OPPONENT_EOT = 35,
|
||||||
|
OPPONENT_CLEANUP = 36,
|
||||||
|
OPPONENT_AFTER_EOT = 37,
|
||||||
|
|
||||||
|
BEFORE_BEGIN = 43,
|
||||||
|
UNTAP = 44,
|
||||||
|
UPKEEP = 45,
|
||||||
|
DRAW = 46,
|
||||||
|
FIRSTMAIN = 47,
|
||||||
|
COMBATBEGIN = 48,
|
||||||
|
COMBATATTACKERS = 49,
|
||||||
|
COMBATBLOCKERS = 50,
|
||||||
|
COMBATDAMAGE = 51,
|
||||||
|
COMBATEND = 52,
|
||||||
|
SECONDMAIN = 53,
|
||||||
|
ENDOFTURN = 54,
|
||||||
|
EOT = 55,
|
||||||
|
CLEANUP = 56,
|
||||||
|
AFTER_EOT = 57,
|
||||||
};
|
};
|
||||||
int restrictions;
|
int restrictions;
|
||||||
int needsTapping;
|
int needsTapping;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
int tapped;
|
int tapped;
|
||||||
|
|
||||||
int lifeOrig;
|
int lifeOrig;
|
||||||
UntapBlockers * untapBlockers;
|
|
||||||
MTGPlayerCards * belongs_to;
|
MTGPlayerCards * belongs_to;
|
||||||
MTGAbility * untapBlockerAbilities[10];
|
MTGAbility * untapBlockerAbilities[10];
|
||||||
MTGCardInstance * getNextPartner();
|
MTGCardInstance * getNextPartner();
|
||||||
@@ -105,7 +104,6 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
MTGCard * model;
|
MTGCard * model;
|
||||||
MTGCardInstance();
|
MTGCardInstance();
|
||||||
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
|
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
|
||||||
UntapBlockers * getUntapBlockers();
|
|
||||||
int regenerate();
|
int regenerate();
|
||||||
int triggerRegenerate();
|
int triggerRegenerate();
|
||||||
Player * controller();
|
Player * controller();
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
#include "../include/config.h"
|
|
||||||
#include "../include/Blocker.h"
|
|
||||||
|
|
||||||
UntapBlocker::UntapBlocker(int id, MTGCardInstance * card):MTGAbility(id, card){
|
|
||||||
init ( NEW ManaCost());
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlocker::UntapBlocker(int id, MTGCardInstance * card, ManaCost * _cost):MTGAbility(id, card){
|
|
||||||
init(_cost);
|
|
||||||
}
|
|
||||||
UntapBlocker::UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target):MTGAbility(id, card,_target){
|
|
||||||
init ( NEW ManaCost());
|
|
||||||
}
|
|
||||||
UntapBlocker::UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target, ManaCost * _cost):MTGAbility(id, card,_target){
|
|
||||||
init(_cost);
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlocker::~UntapBlocker(){
|
|
||||||
SAFE_DELETE(manaCost);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UntapBlocker::init(ManaCost * _cost){
|
|
||||||
currentPhase = -1;
|
|
||||||
manaCost = _cost;
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlocker * UntapBlocker::clone() const{
|
|
||||||
UntapBlocker * a = NEW UntapBlocker(*this);
|
|
||||||
a->isClone = 1;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Default behaviour for blockers : they block the card they're attached to
|
|
||||||
void UntapBlocker::Update(float dt){
|
|
||||||
game = GameObserver::GetInstance();
|
|
||||||
int newPhase = game->getCurrentGamePhase();
|
|
||||||
if (newPhase != currentPhase){
|
|
||||||
MTGCardInstance * _target;
|
|
||||||
if (target){
|
|
||||||
_target = (MTGCardInstance *) target;
|
|
||||||
}else{
|
|
||||||
_target = source;
|
|
||||||
}
|
|
||||||
_target->getUntapBlockers()->Add(this);
|
|
||||||
#if defined (WIN32) || defined (LINUX)
|
|
||||||
char buf[4096];
|
|
||||||
sprintf(buf, "Adding Blocker to %s \n", _target->getName().c_str());
|
|
||||||
OutputDebugString(buf);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
currentPhase = newPhase;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UntapBlocker::destroy(){
|
|
||||||
MTGCardInstance * _target;
|
|
||||||
if (target){
|
|
||||||
_target = (MTGCardInstance *) target;
|
|
||||||
}else{
|
|
||||||
_target = source;
|
|
||||||
}
|
|
||||||
_target->getUntapBlockers()->Remove(this);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlockers::UntapBlockers(){
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UntapBlockers::init(){
|
|
||||||
cursor = -1;
|
|
||||||
|
|
||||||
for (int i=0; i< MAX_BLOCKERS ; i++){
|
|
||||||
blockers[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UntapBlockers::Add (UntapBlocker * ability){
|
|
||||||
game = GameObserver::GetInstance();
|
|
||||||
int index = game->mLayers->actionLayer()->getIndexOf(ability);
|
|
||||||
blockers[index] = 1;
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
int UntapBlockers::Remove (UntapBlocker * ability){
|
|
||||||
game = GameObserver::GetInstance();
|
|
||||||
int index = game->mLayers->actionLayer()->getIndexOf(ability);
|
|
||||||
blockers[index] = 0;
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UntapBlockers::rewind(){
|
|
||||||
cursor = -1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlocker * UntapBlockers::next(){
|
|
||||||
cursor++;
|
|
||||||
game = GameObserver::GetInstance();
|
|
||||||
while (blockers[cursor] == 0){
|
|
||||||
cursor ++;
|
|
||||||
if (cursor == MAX_BLOCKERS){
|
|
||||||
cursor = -1;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (UntapBlocker *) (game->mLayers->actionLayer()->getByIndex(cursor));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UntapBlockers::isEmpty(){
|
|
||||||
for (int i=0; i< MAX_BLOCKERS ; i++){
|
|
||||||
if (blockers[i])
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
UntapBlockers::~UntapBlockers(){
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,6 @@ int CardDescriptor::init(){
|
|||||||
defenser = NULL;
|
defenser = NULL;
|
||||||
banding = NULL;
|
banding = NULL;
|
||||||
//Remove unnecessary pointers
|
//Remove unnecessary pointers
|
||||||
SAFE_DELETE(untapBlockers);
|
|
||||||
SAFE_DELETE(counters);
|
SAFE_DELETE(counters);
|
||||||
SAFE_DELETE(previous);
|
SAFE_DELETE(previous);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
#include "../include/config.h"
|
|
||||||
#include "../include/ConstraintResolver.h"
|
|
||||||
|
|
||||||
|
|
||||||
int ConstraintResolver::untap(GameObserver * game, MTGCardInstance * card){
|
|
||||||
if (!card->isUntapping()){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (card->has(Constants::DOESNOTUNTAP)) return 0;
|
|
||||||
int ok = 1;
|
|
||||||
ManaCost * untapManaCost = NEW ManaCost();
|
|
||||||
UntapBlockers * blockers = card->getUntapBlockers();
|
|
||||||
UntapBlocker * blocker;
|
|
||||||
blockers->rewind();
|
|
||||||
Player * player = game->currentPlayer;
|
|
||||||
while ((blocker = blockers->next())){
|
|
||||||
#if defined (WIN32) || defined (LINUX)
|
|
||||||
char buf[4096];
|
|
||||||
sprintf(buf, "next\n");
|
|
||||||
OutputDebugString(buf);
|
|
||||||
#endif
|
|
||||||
untapManaCost->add(blocker->untapManaCost());
|
|
||||||
}
|
|
||||||
if (player->getManaPool()->canAfford(untapManaCost)){
|
|
||||||
blockers->rewind();
|
|
||||||
while ((blocker = blockers->next())){
|
|
||||||
if (!blocker->unblock()){
|
|
||||||
ok = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
ok = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
player->getManaPool()->pay(untapManaCost);
|
|
||||||
card->attemptUntap();
|
|
||||||
}
|
|
||||||
delete untapManaCost;
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
@@ -435,7 +435,7 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
|||||||
mLayers->actionLayer()->setMenuObject(object);
|
mLayers->actionLayer()->setMenuObject(object);
|
||||||
}
|
}
|
||||||
}else if (card->isTapped() && card->controller() == currentPlayer){
|
}else if (card->isTapped() && card->controller() == currentPlayer){
|
||||||
ConstraintResolver::untap(this, card);
|
untap(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -443,6 +443,17 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GameObserver::untap(MTGCardInstance * card) {
|
||||||
|
if (!card->isUntapping()){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (card->has(Constants::DOESNOTUNTAP)) return 0;
|
||||||
|
|
||||||
|
card->attemptUntap();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TargetChooser * GameObserver::getCurrentTargetChooser(){
|
TargetChooser * GameObserver::getCurrentTargetChooser(){
|
||||||
TargetChooser * _tc = mLayers->actionLayer()->getCurrentTargetChooser();
|
TargetChooser * _tc = mLayers->actionLayer()->getCurrentTargetChooser();
|
||||||
if (_tc) return _tc;
|
if (_tc) return _tc;
|
||||||
|
|||||||
@@ -147,14 +147,18 @@ int AbilityFactory::parseRestriction(string s){
|
|||||||
if (s.find("myturnonly") != string::npos) return ActivatedAbility::PLAYER_TURN_ONLY;
|
if (s.find("myturnonly") != string::npos) return ActivatedAbility::PLAYER_TURN_ONLY;
|
||||||
if (s.find("assorcery") != string::npos) return ActivatedAbility::AS_SORCERY;
|
if (s.find("assorcery") != string::npos) return ActivatedAbility::AS_SORCERY;
|
||||||
|
|
||||||
size_t found = s.find("my");
|
string types[] = {"my","opponent", ""};
|
||||||
if (found !=string::npos){
|
int starts[] = {ActivatedAbility::MY_BEFORE_BEGIN,ActivatedAbility::OPPONENT_BEFORE_BEGIN,ActivatedAbility::BEFORE_BEGIN};
|
||||||
for (int i = 0; i < Constants::NB_MTG_PHASES; i++){
|
for (int j = 0; j < 3; ++j){
|
||||||
string toFind = "my";
|
size_t found = s.find(types[j]);
|
||||||
toFind.append(Constants::MTGPhaseCodeNames[i]).append("only");
|
if (found !=string::npos){
|
||||||
found = s.find(toFind);
|
for (int i = 0; i < Constants::NB_MTG_PHASES; i++){
|
||||||
if (found != string::npos){
|
string toFind = types[j];
|
||||||
return ActivatedAbility::MY_BEFORE_BEGIN + i;
|
toFind.append(Constants::MTGPhaseCodeNames[i]).append("only");
|
||||||
|
found = s.find(toFind);
|
||||||
|
if (found != string::npos){
|
||||||
|
return starts[j] + i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1206,12 +1210,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
game->addObserver(NEW AConvertLandToCreatures(id, card, "forest"));
|
game->addObserver(NEW AConvertLandToCreatures(id, card, "forest"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1124: //Mana Vault
|
case 1124: //Mana Vault (the rest is softcoded!)
|
||||||
{
|
{
|
||||||
int output[] = {Constants::MTG_COLOR_ARTIFACT, 3};
|
|
||||||
game->addObserver(NEW AManaProducer(_id,card,card,NEW ManaCost(output,1)));
|
|
||||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
|
||||||
game->addObserver(NEW AUntapManaBlocker(_id+1, card, NEW ManaCost(cost,1)));
|
|
||||||
game->addObserver(NEW ARegularLifeModifierAura(_id+2, card, card, Constants::MTG_PHASE_DRAW, -1, 1));
|
game->addObserver(NEW ARegularLifeModifierAura(_id+2, card, card, Constants::MTG_PHASE_DRAW, -1, 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1336,13 +1336,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1171: //Paralyze
|
|
||||||
{
|
|
||||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
|
||||||
game->addObserver(NEW AUntapManaBlocker(_id, card,card->target, NEW ManaCost(cost,1)));
|
|
||||||
card->target->tap();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1172: //Pestilence
|
case 1172: //Pestilence
|
||||||
{
|
{
|
||||||
game->addObserver(NEW APestilence(_id, card));
|
game->addObserver(NEW APestilence(_id, card));
|
||||||
@@ -1736,6 +1729,15 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
|||||||
if (cPhase != restrictions - MY_BEFORE_BEGIN + Constants::MTG_PHASE_BEFORE_BEGIN) return 0;
|
if (cPhase != restrictions - MY_BEFORE_BEGIN + Constants::MTG_PHASE_BEFORE_BEGIN) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restrictions>= OPPONENT_BEFORE_BEGIN && restrictions <= OPPONENT_AFTER_EOT){
|
||||||
|
if (player == game->currentPlayer) return 0;
|
||||||
|
if (cPhase != restrictions - OPPONENT_BEFORE_BEGIN + Constants::MTG_PHASE_BEFORE_BEGIN) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (restrictions>= BEFORE_BEGIN && restrictions <= AFTER_EOT){
|
||||||
|
if (cPhase != restrictions - BEFORE_BEGIN + Constants::MTG_PHASE_BEFORE_BEGIN) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (card == source && source->controller()==player && (!needsTapping || (!source->isTapped() && !source->hasSummoningSickness()))){
|
if (card == source && source->controller()==player && (!needsTapping || (!source->isTapped() && !source->hasSummoningSickness()))){
|
||||||
if (!cost) return 1;
|
if (!cost) return 1;
|
||||||
if (!mana) mana = player->getManaPool();
|
if (!mana) mana = player->getManaPool();
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ void MTGCardInstance::copy(MTGCardInstance * card){
|
|||||||
|
|
||||||
MTGCardInstance::~MTGCardInstance(){
|
MTGCardInstance::~MTGCardInstance(){
|
||||||
LOG("==Deleting MTGCardInstance==");
|
LOG("==Deleting MTGCardInstance==");
|
||||||
SAFE_DELETE(untapBlockers);
|
|
||||||
SAFE_DELETE(counters);
|
SAFE_DELETE(counters);
|
||||||
SAFE_DELETE(previous);
|
SAFE_DELETE(previous);
|
||||||
LOG("==Deleting MTGCardInstance Succesfull==");
|
LOG("==Deleting MTGCardInstance Succesfull==");
|
||||||
@@ -102,7 +101,6 @@ void MTGCardInstance::initMTGCI(){
|
|||||||
doDamageTest = 1;
|
doDamageTest = 1;
|
||||||
belongs_to=NULL;
|
belongs_to=NULL;
|
||||||
tapped = 0;
|
tapped = 0;
|
||||||
untapBlockers = NULL;
|
|
||||||
untapping = 0;
|
untapping = 0;
|
||||||
summoningSickness = 1;
|
summoningSickness = 1;
|
||||||
target = NULL;
|
target = NULL;
|
||||||
@@ -159,11 +157,6 @@ int MTGCardInstance::removeType(int id, int removeAll){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
UntapBlockers * MTGCardInstance::getUntapBlockers(){
|
|
||||||
if (!untapBlockers) untapBlockers = NEW UntapBlockers();
|
|
||||||
return untapBlockers;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MTGCardInstance::isInPlay(){
|
int MTGCardInstance::isInPlay(){
|
||||||
GameObserver * game = GameObserver::GetInstance();
|
GameObserver * game = GameObserver::GetInstance();
|
||||||
for (int i = 0 ; i < 2 ; i++){
|
for (int i = 0 ; i < 2 ; i++){
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ void MTGInPlay::untapAll(){
|
|||||||
for (i = 0; i < nb_cards; i ++){
|
for (i = 0; i < nb_cards; i ++){
|
||||||
MTGCardInstance * card = cards[i];
|
MTGCardInstance * card = cards[i];
|
||||||
card->setUntapping();
|
card->setUntapping();
|
||||||
if (!card->basicAbilities[Constants::DOESNOTUNTAP] && card->getUntapBlockers()->isEmpty()){
|
if (!card->basicAbilities[Constants::DOESNOTUNTAP]){
|
||||||
card->attemptUntap();
|
card->attemptUntap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,10 +338,6 @@
|
|||||||
RelativePath=".\src\AIStats.cpp"
|
RelativePath=".\src\AIStats.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\Blocker.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\CardDescriptor.cpp"
|
RelativePath=".\src\CardDescriptor.cpp"
|
||||||
>
|
>
|
||||||
@@ -362,10 +358,6 @@
|
|||||||
RelativePath=".\src\CardSelector.cpp"
|
RelativePath=".\src\CardSelector.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\ConstraintResolver.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Counters.cpp"
|
RelativePath=".\src\Counters.cpp"
|
||||||
>
|
>
|
||||||
@@ -749,10 +741,6 @@
|
|||||||
RelativePath=".\include\AllAbilities.h"
|
RelativePath=".\include\AllAbilities.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\Blocker.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\CardDescriptor.h"
|
RelativePath=".\include\CardDescriptor.h"
|
||||||
>
|
>
|
||||||
@@ -781,10 +769,6 @@
|
|||||||
RelativePath=".\include\config.h"
|
RelativePath=".\include\config.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\ConstraintResolver.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Counters.h"
|
RelativePath=".\include\Counters.h"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user