Commit e7ba9135 authored by fallenstardust's avatar fallenstardust

add total attack

parent 99875ec9
...@@ -1520,17 +1520,28 @@ void ClientField::UpdateDeclarableCode(bool enter) { ...@@ -1520,17 +1520,28 @@ void ClientField::UpdateDeclarableCode(bool enter) {
UpdateDeclarableCodeOpcode(enter); UpdateDeclarableCodeOpcode(enter);
} }
void ClientField::RefreshCardCountDisplay() { void ClientField::RefreshCardCountDisplay() {
ClientCard* pcard;
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size(); mainGame->dInfo.card_count[p] = hand[p].size();
mainGame->dInfo.total_attack[p] = 0;
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) { for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
if(*it) pcard = *it;
mainGame->dInfo.card_count[p]++; if(pcard) {
if(pcard->type & TYPE_LINK && pcard->link)
mainGame->dInfo.card_count[p] += pcard->link;
else
mainGame->dInfo.card_count[p]++;
if(pcard->position == POS_FACEUP_ATTACK && pcard->attack > 0 && (p == 1 || mainGame->dInfo.curMsg != MSG_SELECT_BATTLECMD || pcard->cmdFlag & COMMAND_ATTACK))
mainGame->dInfo.total_attack[p] += pcard->attack;
}
} }
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) { for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
if(*it) pcard = *it;
if(pcard)
mainGame->dInfo.card_count[p]++; mainGame->dInfo.card_count[p]++;
} }
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]); myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
myswprintf(mainGame->dInfo.str_total_attack[p], L"%d", mainGame->dInfo.total_attack[p]);
} }
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) { if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00; mainGame->dInfo.card_count_color[0] = 0xffffff00;
...@@ -1542,5 +1553,15 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1542,5 +1553,15 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count_color[0] = 0xffffffff; mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff; mainGame->dInfo.card_count_color[1] = 0xffffffff;
} }
if(mainGame->dInfo.total_attack[0] > mainGame->dInfo.total_attack[1]) {
mainGame->dInfo.total_attack_color[0] = 0xffffff00;
mainGame->dInfo.total_attack_color[1] = 0xffff2a00;
} else if(mainGame->dInfo.total_attack[1] > mainGame->dInfo.total_attack[0]) {
mainGame->dInfo.total_attack_color[1] = 0xffffff00;
mainGame->dInfo.total_attack_color[0] = 0xffff2a00;
} else {
mainGame->dInfo.total_attack_color[0] = 0xffffffff;
mainGame->dInfo.total_attack_color[1] = 0xffffffff;
}
} }
} }
...@@ -62,6 +62,7 @@ struct DuelInfo { ...@@ -62,6 +62,7 @@ struct DuelInfo {
bool tag_player[2]; bool tag_player[2];
int lp[2]; int lp[2];
int card_count[2]; int card_count[2];
int total_attack[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -78,7 +79,9 @@ struct DuelInfo { ...@@ -78,7 +79,9 @@ struct DuelInfo {
wchar_t str_time_left[2][16]; wchar_t str_time_left[2][16];
video::SColor time_color[2]; video::SColor time_color[2];
wchar_t str_card_count[2][16]; wchar_t str_card_count[2][16];
wchar_t str_total_attack[2][16];
video::SColor card_count_color[2]; video::SColor card_count_color[2];
video::SColor total_attack_color[2];
bool isReplaySwapped; bool isReplaySwapped;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment