- 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

View File

@@ -152,7 +152,7 @@ Difficulty Bonus=Bonus Difficulte
'Live dangerously and you live right' Bonus=Bonus 'Vivre dangereusement et fierement'
Life Delta Bonus=Bonus Points de vie
'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
Congratulations! You earn %i credits=Felicitations, vous gagnez %i credits
You have been defeated=Vous avez perdu

View File

@@ -646,7 +646,7 @@ subtype=Aura
abilities=flash
[/card]
[card]
text=Nezumi Cutthroat can't block.
text=Fear. Nezumi Cutthroat can't block.
id=80521
name=Nezumi Cutthroat
rarity=C
@@ -655,7 +655,7 @@ type=Creature
subtype=Rat Warrior
power=2
toughness=1
abilities=cantblock
abilities=cantblock,fear
[/card]
[card]
text=All Creatures get -1/-1.

View File

@@ -62,6 +62,7 @@ class AIPlayer: public Player{
public:
void End(){};
virtual int displayStack() {return 0;};
int receiveEvent(WEvent * event);
AIStats * stats;
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
AIPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);

View File

@@ -12,6 +12,7 @@ class Player;
class MTGCardInstance;
class MTGCard;
class Damage;
class WEvent;
class AIStat{
public:
@@ -31,12 +32,12 @@ class AIStats{
list<AIStat *> stats;
AIStats(Player * _player, char * filename);
~AIStats();
void updateStats();
void load(char * filename);
void save();
AIStat * find(MTGCard * card);
bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true );
void updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, float multiplier = 1.0);
int receiveEvent(WEvent * event);
};
#endif

View File

@@ -37,6 +37,8 @@ class Player: public Damageable{
JQuad * getIcon();
string deckFile;
string deckFileSmall;
virtual int receiveEvent(WEvent * event){return 0;};
};
class HumanPlayer: public Player{

View File

@@ -727,6 +727,11 @@ int AIPlayerBaka::computeActions(){
return 1;
};
int AIPlayer::receiveEvent(WEvent * event){
if (getStats()) return getStats()->receiveEvent(event);
return 0;
}
int AIPlayerBaka::Act(float dt){
GameObserver * g = GameObserver::GetInstance();
@@ -736,9 +741,6 @@ int AIPlayerBaka::Act(float dt){
int currentGamePhase = g->getCurrentGamePhase();
if (currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentGamePhase != oldGamePhase){
if (getStats()) getStats()->updateStats();
}
oldGamePhase = currentGamePhase;
timer-= dt;

View File

@@ -3,6 +3,7 @@
#include "../include/GameObserver.h"
#include "../include/Player.h"
#include "../include/MTGCardInstance.h"
#include "../include/WEvent.h"
bool compare_aistats(AIStat * first, AIStat * second){
float damage1 = first->value / first->occurences;
@@ -42,25 +43,24 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
}
}
void AIStats::updateStats(){
GameObserver * game = GameObserver::GetInstance();
ActionStack * as = game->mLayers->stackLayer();
Damage * damage = ((Damage * )as->getNext(NULL,ACTION_DAMAGE, RESOLVED_OK));
MTGGameZone * opponentZone = player->opponent()->game->inPlay;
while(damage){
MTGCardInstance * card = damage->source;
updateStatsCard(card,damage);
int AIStats::receiveEvent(WEvent * event){
WEventDamage * e = dynamic_cast<WEventDamage *>(event);
if (!e) return 0; //we take only Damage events into accountright now
Damage * damage = e->damage;
MTGGameZone * opponentZone = player->opponent()->game->inPlay;
//Auras on damage source can be the cause
for (int i=0; i < opponentZone->nb_cards; i++){
MTGCardInstance * aura = opponentZone->cards[i];
if (aura->target == card){
updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER);
}
MTGCardInstance * card = damage->source;
updateStatsCard(card,damage);
//Auras on damage source can be the cause
for (int i = 0; i < opponentZone->nb_cards; ++i){
MTGCardInstance * aura = opponentZone->cards[i];
if (aura->target == card){
updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER);
}
damage = ((Damage * )as->getNext(damage,ACTION_DAMAGE, RESOLVED_OK));
}
stats.sort(compare_aistats);
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?
}
bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue ){

View File

@@ -458,6 +458,9 @@ int GameObserver::receiveEvent(WEvent * e){
while(eventsQueue.size()){
WEvent * ev = eventsQueue.front();
result += mLayers->receiveEvent(ev);
for (int i = 0; i < 2; ++i){
result += players[i]->receiveEvent(ev);
}
SAFE_DELETE(ev);
eventsQueue.pop();
}

View File

@@ -11,7 +11,7 @@
#include "../include/utils.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 MAX_ANGLE_MULTIPLIER (3*M_PI)