Commit 180801da authored by nanahira's avatar nanahira

tmp thing

parent b13c1307
......@@ -315,23 +315,25 @@ bool SingleDuel::IsSkyStriker(unsigned int code) {
}
void SingleDuel::CheckSkyStriker(unsigned char player_id) {
if((int32)pdeck[0].main.size() > 41) {
if((int32)pdeck[player_id].main.size() > 41) {
is_skystriker[player_id] = false;
printf("Player %d has %d cards in main deck and is not a Sky Striker deck\n", player_id, pdeck[0].main.size());
return;
}
unsigned short skystricker_count = 0;
for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[0].main[i]->first))
for(int32 i = (int32)pdeck[player_id].main.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[player_id].main[i]->first))
skystricker_count++;
}
for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[0].extra[i]->first))
for(int32 i = (int32)pdeck[player_id].extra.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[player_id].extra[i]->first))
skystricker_count++;
}
is_skystriker[player_id] = skystricker_count >= 23;
printf("Player %d has %d Sky Striker cards and is %sa Sky Striker deck\n", player_id, skystricker_count, is_skystriker[player_id] ? "" : "not ");
}
void SingleDuel::UpdateDeck(DuelPlayer* dp, void* pdata, unsigned int len) {
......@@ -464,6 +466,9 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
Deck d = pdeck[0];
pdeck[0] = pdeck[1];
pdeck[1] = d;
bool b = is_skystriker[0];
is_skystriker[0] = is_skystriker[1];
is_skystriker[1] = b;
swapped = true;
}
dp->state = CTOS_RESPONSE;
......@@ -525,13 +530,16 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
}
for (int32 p = 0; p < 2; ++p) {
if (is_skystriker[p]) {
printf("Adding Sky Striker cards to player %d\n", p);
// add sky striker cards
// add 10 fireballs with code 46130346
new_card(pduel, 46130346, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
for(int i = 0; i < 10; ++i)
new_card(pduel, 46130346, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
// add 5 effect veilers with code 97268402
new_card(pduel, 97268402, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
for(int i = 0; i < 5; ++i)
new_card(pduel, 97268402, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
}
}
last_replay.Flush();
......@@ -555,6 +563,8 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
NetServer::SendBufferToPlayer(*oit, STOC_GAME_MSG, startbuf, 19);
RefreshExtra(0);
RefreshExtra(1);
RefreshGrave(0, 0xefffff, 0);
RefreshGrave(1, 0xefffff, 0);
start_duel(pduel, opt);
if(host_info.time_limit) {
time_elapsed = 0;
......@@ -610,6 +620,9 @@ void SingleDuel::DuelEndProc() {
Deck d = pdeck[0];
pdeck[0] = pdeck[1];
pdeck[1] = d;
bool b = is_skystriker[0];
is_skystriker[0] = is_skystriker[1];
is_skystriker[1] = b;
}
ready[0] = false;
ready[1] = false;
......
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