Erwan
- fix issue 151 (I hope) - small french translation Update - Nezumi Cutthroat fix
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 ){
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user