- fix issue 151 (I hope)
- small french translation Update
- Nezumi Cutthroat fix
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-03 03:51:05 +00:00
parent 7fd44a077e
commit 1d20f37ded
9 changed files with 33 additions and 24 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ Difficulty Bonus=Bonus Difficulte
'Live dangerously and you live right' Bonus=Bonus 'Vivre dangereusement et fierement' 'Live dangerously and you live right' Bonus=Bonus 'Vivre dangereusement et fierement'
Life Delta Bonus=Bonus Points de vie Life Delta Bonus=Bonus Points de vie
'Decree of Theophilus' Bonus=Bonus 'Decret de Teophile' 'Decree of Theophilus' Bonus=Bonus 'Decret de Teophile'
'Fast and Furious' Bonus=Bonus 'Rapide et Dangereux' 'Fast and Furious' Bonus=Bonus 'Fast and Furious'
Victory=Victoire Victory=Victoire
Congratulations! You earn %i credits=Felicitations, vous gagnez %i credits Congratulations! You earn %i credits=Felicitations, vous gagnez %i credits
You have been defeated=Vous avez perdu You have been defeated=Vous avez perdu
+2 -2
View File
@@ -646,7 +646,7 @@ subtype=Aura
abilities=flash abilities=flash
[/card] [/card]
[card] [card]
text=Nezumi Cutthroat can't block. text=Fear. Nezumi Cutthroat can't block.
id=80521 id=80521
name=Nezumi Cutthroat name=Nezumi Cutthroat
rarity=C rarity=C
@@ -655,7 +655,7 @@ type=Creature
subtype=Rat Warrior subtype=Rat Warrior
power=2 power=2
toughness=1 toughness=1
abilities=cantblock abilities=cantblock,fear
[/card] [/card]
[card] [card]
text=All Creatures get -1/-1. text=All Creatures get -1/-1.
+1
View File
@@ -62,6 +62,7 @@ class AIPlayer: public Player{
public: public:
void End(){}; void End(){};
virtual int displayStack() {return 0;}; virtual int displayStack() {return 0;};
int receiveEvent(WEvent * event);
AIStats * stats; AIStats * stats;
ManaCost * getPotentialMana(MTGCardInstance * card = NULL); ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
AIPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall); AIPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);
+2 -1
View File
@@ -12,6 +12,7 @@ class Player;
class MTGCardInstance; class MTGCardInstance;
class MTGCard; class MTGCard;
class Damage; class Damage;
class WEvent;
class AIStat{ class AIStat{
public: public:
@@ -31,12 +32,12 @@ class AIStats{
list<AIStat *> stats; list<AIStat *> stats;
AIStats(Player * _player, char * filename); AIStats(Player * _player, char * filename);
~AIStats(); ~AIStats();
void updateStats();
void load(char * filename); void load(char * filename);
void save(); void save();
AIStat * find(MTGCard * card); AIStat * find(MTGCard * card);
bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true ); bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true );
void updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, float multiplier = 1.0); void updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, float multiplier = 1.0);
int receiveEvent(WEvent * event);
}; };
#endif #endif
+2
View File
@@ -37,6 +37,8 @@ class Player: public Damageable{
JQuad * getIcon(); JQuad * getIcon();
string deckFile; string deckFile;
string deckFileSmall; string deckFileSmall;
virtual int receiveEvent(WEvent * event){return 0;};
}; };
class HumanPlayer: public Player{ class HumanPlayer: public Player{
+5 -3
View File
@@ -727,6 +727,11 @@ int AIPlayerBaka::computeActions(){
return 1; return 1;
}; };
int AIPlayer::receiveEvent(WEvent * event){
if (getStats()) return getStats()->receiveEvent(event);
return 0;
}
int AIPlayerBaka::Act(float dt){ int AIPlayerBaka::Act(float dt){
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
@@ -736,9 +741,6 @@ int AIPlayerBaka::Act(float dt){
int currentGamePhase = g->getCurrentGamePhase(); int currentGamePhase = g->getCurrentGamePhase();
if (currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentGamePhase != oldGamePhase){
if (getStats()) getStats()->updateStats();
}
oldGamePhase = currentGamePhase; oldGamePhase = currentGamePhase;
timer-= dt; timer-= dt;
+9 -9
View File
@@ -3,6 +3,7 @@
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/Player.h" #include "../include/Player.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
#include "../include/WEvent.h"
bool compare_aistats(AIStat * first, AIStat * second){ bool compare_aistats(AIStat * first, AIStat * second){
float damage1 = first->value / first->occurences; float damage1 = first->value / first->occurences;
@@ -42,25 +43,24 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
} }
} }
void AIStats::updateStats(){ int AIStats::receiveEvent(WEvent * event){
GameObserver * game = GameObserver::GetInstance(); WEventDamage * e = dynamic_cast<WEventDamage *>(event);
ActionStack * as = game->mLayers->stackLayer(); if (!e) return 0; //we take only Damage events into accountright now
Damage * damage = ((Damage * )as->getNext(NULL,ACTION_DAMAGE, RESOLVED_OK)); Damage * damage = e->damage;
MTGGameZone * opponentZone = player->opponent()->game->inPlay; MTGGameZone * opponentZone = player->opponent()->game->inPlay;
while(damage){
MTGCardInstance * card = damage->source; MTGCardInstance * card = damage->source;
updateStatsCard(card,damage); updateStatsCard(card,damage);
//Auras on damage source can be the cause //Auras on damage source can be the cause
for (int i=0; i < opponentZone->nb_cards; i++){ for (int i = 0; i < opponentZone->nb_cards; ++i){
MTGCardInstance * aura = opponentZone->cards[i]; MTGCardInstance * aura = opponentZone->cards[i];
if (aura->target == card){ if (aura->target == card){
updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER); updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER);
} }
} }
damage = ((Damage * )as->getNext(damage,ACTION_DAMAGE, RESOLVED_OK)); stats.sort(compare_aistats); //this could be slow, if it is, let's run it only at the end of the turn
} return 1; //is this meant to return 0 or 1?
stats.sort(compare_aistats);
} }
bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue ){ bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue ){
+3
View File
@@ -458,6 +458,9 @@ int GameObserver::receiveEvent(WEvent * e){
while(eventsQueue.size()){ while(eventsQueue.size()){
WEvent * ev = eventsQueue.front(); WEvent * ev = eventsQueue.front();
result += mLayers->receiveEvent(ev); result += mLayers->receiveEvent(ev);
for (int i = 0; i < 2; ++i){
result += players[i]->receiveEvent(ev);
}
SAFE_DELETE(ev); SAFE_DELETE(ev);
eventsQueue.pop(); eventsQueue.pop();
} }
+1 -1
View File
@@ -11,7 +11,7 @@
#include "../include/utils.h" #include "../include/utils.h"
#include "../include/DeckDataWrapper.h" #include "../include/DeckDataWrapper.h"
static const char* GAME_VERSION = "WTH?! 0.9.2 - by wololo"; static const char* GAME_VERSION = "WTH?! 0.9.3 - by wololo";
#define DEFAULT_ANGLE_MULTIPLIER 0.4 #define DEFAULT_ANGLE_MULTIPLIER 0.4
#define MAX_ANGLE_MULTIPLIER (3*M_PI) #define MAX_ANGLE_MULTIPLIER (3*M_PI)