From 62a7a0e211ef5e1de8cd9e7819c767b4f721e102 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew" Date: Sun, 9 Nov 2008 07:34:40 +0000 Subject: [PATCH] Erwan - a few extra cards in Alara - Added missing phaseRing files (sorry...) --- projects/mtg/bin/Res/sets/ALA/_cards.dat | 34 ++++++++++ projects/mtg/bin/Res/sets/ALA/todo.dat | 30 --------- projects/mtg/include/PhaseRing.h | 34 ++++++++++ projects/mtg/src/PhaseRing.cpp | 85 ++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 30 deletions(-) create mode 100644 projects/mtg/include/PhaseRing.h create mode 100644 projects/mtg/src/PhaseRing.cpp diff --git a/projects/mtg/bin/Res/sets/ALA/_cards.dat b/projects/mtg/bin/Res/sets/ALA/_cards.dat index c0468c06d..8e9aa34a6 100644 --- a/projects/mtg/bin/Res/sets/ALA/_cards.dat +++ b/projects/mtg/bin/Res/sets/ALA/_cards.dat @@ -93,6 +93,19 @@ subtype=Elf Scout toughness=2 [/card] [card] +text=Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.) {W}, {T}: Dawnray Archer deals 1 damage to target attacking or blocking creature. +abilities=exalted +auto={W}{T}:damage:1 target(creature[attacking;blocking]) +id=175085 +name=Dawnray Archer +rarity=U +type=Creature +mana={2}{U} +power=1 +subtype=Human Archer +toughness=1 +[/card] +[card] text=First strike Shroud (This creature can't be the target of spells or abilities.) abilities=first strike, shroud id=175121 @@ -142,6 +155,18 @@ subtype=Elf Shaman toughness=1 [/card] [card] +text={2}{U}: Untap target artifact. +auto={2}{U}:untap target(artifact) +id=174888 +name=Filigree Sages +rarity=U +type=Artifact Creature +mana={3}{U} +power=2 +subtype=Vedalken Wizard +toughness=3 +[/card] +[card] text={T}: Add {G} to your mana pool. auto={T}:Add {G} id=174927 @@ -309,6 +334,15 @@ mana={2}{R} subtype=Aura [/card] [card] +text={T}: You gain 1 life. +auto={T}:life:1 +id=175249 +name=Marble Chalice +rarity=C +type=Artifact +mana={2}{W} +[/card] +[card] text={W}, {T}: Regenerate target artifact. id=175113 auto={W},{T}:Regenerate target(artifact) diff --git a/projects/mtg/bin/Res/sets/ALA/todo.dat b/projects/mtg/bin/Res/sets/ALA/todo.dat index 4767a3e91..37c4a6b91 100644 --- a/projects/mtg/bin/Res/sets/ALA/todo.dat +++ b/projects/mtg/bin/Res/sets/ALA/todo.dat @@ -342,17 +342,6 @@ subtype=Human Wizard toughness=2 [/card] [card] -text=Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.) {W}, {T}: Dawnray Archer deals 1 damage to target attacking or blocking creature. -id=175085 -name=Dawnray Archer -rarity=U -type=Creature -mana={2}{U} -power=1 -subtype=Human Archer -toughness=1 -[/card] -[card] text=Skeleton creatures you control and other Zombie creatures you control get +1/+1 and have deathtouch. id=176430 name=Death Baron @@ -561,17 +550,6 @@ subtype=Hydra Beast toughness=0 [/card] [card] -text={2}{U}: Untap target artifact. -id=174888 -name=Filigree Sages -rarity=U -type=Artifact Creature -mana={3}{U} -power=2 -subtype=Vedalken Wizard -toughness=3 -[/card] -[card] text=First strike Unearth {U}{B}{R} ({U}{B}{R}: Return this card from your graveyard to play. It gains haste. Remove it from the game at end of turn or if it would leave play. Unearth only as a sorcery.) id=176447 name=Fire-Field Ogre @@ -929,14 +907,6 @@ subtype=Ooze toughness=1 [/card] [card] -text={T}: You gain 1 life. -id=175249 -name=Marble Chalice -rarity=C -type=Artifact -mana={2}{W} -[/card] -[card] text=Master of Etherium's power and toughness are each equal to the number of artifacts you control. Other artifact creatures you control get +1/+1. id=175114 name=Master of Etherium diff --git a/projects/mtg/include/PhaseRing.h b/projects/mtg/include/PhaseRing.h new file mode 100644 index 000000000..92987df48 --- /dev/null +++ b/projects/mtg/include/PhaseRing.h @@ -0,0 +1,34 @@ +#ifndef _PHASERING_H_ +#define _PHASERING_H_ + +#include +using std::list; + +/* +The class that handles the phases of a turn +*/ + +class Player; + +class Phase{ +public: + int id; + Player * player; + Phase(int _id, Player * _player):id(_id),player(_player){}; +}; + +class PhaseRing{ +public: + list ring; + list::iterator current; + Phase * getCurrentPhase(); + Phase * forward(); + Phase * goToPhase(int id, Player * player); + PhaseRing(Player* players[], int nbPlayers=2); + ~PhaseRing(); + int addPhase(Phase * phase); + int addPhaseBefore(int id, Player* player,int after_id, Player * after_player, int allOccurences = 1); + int removePhase (int id, Player * player, int allOccurences = 1); +}; + +#endif \ No newline at end of file diff --git a/projects/mtg/src/PhaseRing.cpp b/projects/mtg/src/PhaseRing.cpp new file mode 100644 index 000000000..930677cf6 --- /dev/null +++ b/projects/mtg/src/PhaseRing.cpp @@ -0,0 +1,85 @@ +#include "../include/PhaseRing.h" +#include "../include/MTGDefinitions.h" +#include "../include/Player.h" +#include "../include/debug.h" + + + +/* Creates a new phase ring with the default rules */ +PhaseRing::PhaseRing(Player* players[], int nbPlayers){ + for (int i = 0; i < nbPlayers; i++){ + for (int j = 0; j ::iterator it; + for (it = ring.begin(); it != ring.end(); it++){ + Phase * currentPhase = *it; + delete(currentPhase); + } +} + +Phase * PhaseRing::getCurrentPhase(){ + if (current == ring.end()){ + current = ring.begin(); + } + return *current; +} + +Phase * PhaseRing::forward(){ + if (current != ring.end()) current++; + if (current == ring.end()) current = ring.begin(); + return *current; +} + +Phase * PhaseRing::goToPhase(int id, Player * player){ + Phase * currentPhase = *current; + while(currentPhase->id !=id || currentPhase->player !=player){ //Dangerous, risk for inifinte loop ! +#ifdef WIN32 + OutputDebugString("goto"); +#endif + currentPhase = forward(); + } + return currentPhase; +} + +int PhaseRing::addPhase(Phase * phase){ + ring.push_back(phase); + return 1; +} + +int PhaseRing::addPhaseBefore(int id, Player* player,int after_id, Player * after_player, int allOccurences){ + int result = 0; + list::iterator it; + for (it = ring.begin(); it != ring.end(); it++){ + Phase * currentPhase = *it; + if (currentPhase->id == after_id && currentPhase->player == after_player){ + result++; + ring.insert(it,NEW Phase(id,player)); + if (!allOccurences) return 1; + } + } + return result; +} +int PhaseRing::removePhase (int id, Player * player, int allOccurences){ + int result = 0; + list::iterator it = ring.begin(); + while (it != ring.end()){ + Phase * currentPhase = *it; + if (currentPhase->id == id && currentPhase->player == player){ + if (current == it) current++; //Avoid our cursor to get invalidated + it = ring.erase(it); + delete(currentPhase); + result++; + if (!allOccurences) return 1; + }else{ + it++; + } + } + return result; +} \ No newline at end of file