Commit 8dcde6da authored by argon.sun's avatar argon.sun

new

parent 6428702b
......@@ -27,6 +27,7 @@ wchar_t DuelClient::event_string[256];
mtrandom DuelClient::rnd;
bool DuelClient::is_refreshing = false;
int DuelClient::match_kill = 0;
std::vector<HostPacket> DuelClient::hosts;
std::set<unsigned int> DuelClient::remotes;
event* DuelClient::resp_event = 0;
......@@ -485,6 +486,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.tag_player[1] = false;
}
mainGame->gMutex.Unlock();
match_kill = 0;
break;
}
case STOC_DUEL_END: {
......@@ -818,14 +820,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcardcode = 3;
else if(mainGame->LocalPlayer(player) == 0) {
mainGame->showcardcode = 1;
if(type < 0x10)
if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.clientname, dataManager.GetVictoryString(type));
else
myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type));
mainGame->dInfo.vic_string = vic_buf;
} else {
mainGame->showcardcode = 2;
if(type < 0x10)
if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.hostname, dataManager.GetVictoryString(type));
else
myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type));
......@@ -2826,6 +2832,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
return true;
}
case MSG_MATCH_KILL: {
match_kill = BufferIO::ReadInt32(pbuf);
return true;
}
case MSG_TAG_SWAP: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int mcount = BufferIO::ReadInt8(pbuf);
......
......@@ -68,6 +68,7 @@ public:
protected:
static bool is_refreshing;
static int match_kill;
static event* resp_event;
static std::set<unsigned int> remotes;
public:
......
......@@ -638,6 +638,10 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
case MSG_MATCH_KILL: {
pbuf += 4;
break;
}
case MSG_TAG_SWAP: {
player = pbuf[0];
pbuf += pbuf[3] * 4 + 8;
......
......@@ -11,6 +11,7 @@ namespace ygo {
SingleDuel::SingleDuel(bool is_match) {
match_mode = is_match;
match_kill = 0;
for(int i = 0; i < 2; ++i) {
players[i] = 0;
ready[i] = false;
......@@ -478,19 +479,10 @@ void SingleDuel::DuelEndProc() {
int winc[3] = {0, 0, 0};
for(int i = 0; i < duel_count; ++i)
winc[match_result[i]]++;
if(winc[0] == 2 || (winc[0] == 1 && winc[2] == 2)) {
NetServer::SendPacketToPlayer(players[0], STOC_DUEL_END);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
NetServer::StopServer();
} else if(winc[1] == 2 || (winc[1] == 1 && winc[2] == 2)) {
NetServer::SendPacketToPlayer(players[0], STOC_DUEL_END);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
NetServer::StopServer();
} else if(winc[2] == 3 || (winc[0] == 1 && winc[1] == 1 && winc[2] == 1)) {
if(match_kill
|| (winc[0] == 2 || (winc[0] == 1 && winc[2] == 2))
|| (winc[1] == 2 || (winc[1] == 1 && winc[2] == 2))
|| (winc[2] == 3 || (winc[0] == 1 && winc[1] == 1 && winc[2] == 1)) ) {
NetServer::SendPacketToPlayer(players[0], STOC_DUEL_END);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
......@@ -1278,6 +1270,17 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit);
break;
}
case MSG_MATCH_KILL: {
int code = BufferIO::ReadInt32(pbuf);
if(match_mode) {
match_kill = code;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
}
break;
}
}
}
return 0;
......
......@@ -51,6 +51,7 @@ protected:
std::set<DuelPlayer*> observers;
Replay last_replay;
bool match_mode;
int match_kill;
unsigned char duel_count;
unsigned char tp_player;
unsigned char match_result[3];
......
......@@ -601,6 +601,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
SinglePlayRefreshExtra(player);
break;
}
case MSG_MATCH_KILL: {
pbuf += 4;
break;
}
case MSG_RELOAD_FIELD: {
mainGame->gMutex.Lock();
mainGame->dField.Clear();
......
......@@ -1353,6 +1353,10 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
RefreshHand(1, 0x181fff, 0);
break;
}
case MSG_MATCH_KILL: {
pbuf += 4;
break;
}
}
}
return 0;
......
......@@ -349,7 +349,7 @@ public:
#define STATUS_TO_DISABLE 0x0004 //
#define STATUS_PROC_COMPLETE 0x0008 //
#define STATUS_SET_TURN 0x0010 //
#define STATUS_ACTIVATING 0x0020 //
#define STATUS_FLIP_SUMMONED 0x0020 //
#define STATUS_REVIVE_LIMIT 0x0040 //
#define STATUS_ATTACKED 0x0080 //
#define STATUS_FORM_CHANGED 0x0100 //
......
......@@ -342,6 +342,7 @@ public:
#define EFFECT_REVERSE_DECK 294
#define EFFECT_REMOVE_BRAINWASHING 295
#define EFFECT_BP_TWICE 296
#define EFFECT_MATCH_KILL 300
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -52,7 +52,6 @@ field::field(duel* pduel) {
for (int i = 0; i < 5; ++i)
core.pre_field[i] = 0;
core.summoning_card = 0;
core.spsummoning_card = 0;
core.summon_depth = 0;
core.chain_limit = 0;
core.chain_limit_p = 0;
......
......@@ -216,7 +216,6 @@ struct processor {
effect* reason_effect;
uint8 reason_player;
card* summoning_card;
card* spsummoning_card;
uint8 summon_depth;
card* attacker;
card* sub_attacker;
......@@ -741,4 +740,6 @@ public:
#define MSG_RELOAD_FIELD 162
#define MSG_AI_NAME 163
#define MSG_SHOW_HINT 164
#define MSG_MATCH_KILL 170
#define MSG_CUSTOM_MSG 180
#endif /* FIELD_H_ */
......@@ -452,6 +452,10 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
core.units.begin()->arg2 = (core.units.begin()->arg2 & 0xff000000) + (val & 0xffffff);
raise_event(reason_card, EVENT_DAMAGE, reason_effect, reason, reason_player, playerid, val);
if(reason == REASON_BATTLE && reason_card) {
if((player[playerid].lp <= 0) && (core.attack_target == 0) && reason_card->is_affected_by_effect(EFFECT_MATCH_KILL)) {
pduel->write_buffer8(MSG_MATCH_KILL);
pduel->write_buffer32(reason_card->data.code);
}
raise_single_event(reason_card, 0, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, playerid, val);
raise_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, playerid, val);
}
......@@ -1236,6 +1240,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
effect* pextra = (effect*)core.temp_var[0];
pextra->get_value(target);
}
target->set_status(STATUS_FLIP_SUMMONED, FALSE);
target->enable_field_effect(FALSE);
if(is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
move_to_field(target, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP);
......@@ -1442,6 +1447,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
case 3: {
target->set_status(STATUS_SUMMONING, FALSE);
target->enable_field_effect(TRUE);
target->set_status(STATUS_FLIP_SUMMONED, TRUE);
if(target->is_status(STATUS_DISABLED))
target->reset(RESET_DISABLE, RESET_EVENT);
target->set_status(STATUS_SUMMON_TURN, TRUE);
......@@ -1810,8 +1816,8 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
core.phase_action = TRUE;
target->current.reason_effect = core.units.begin()->peffect;
target->set_status(STATUS_SUMMONING, TRUE);
target->set_status(STATUS_SUMMON_DISABLED, FALSE);
core.spsummoning_card = target;
target->set_status(STATUS_SUMMON_DISABLED | STATUS_FLIP_SUMMONED, FALSE);
core.summoning_card = target;
pduel->write_buffer8(MSG_SPSUMMONING);
pduel->write_buffer32(target->data.code);
pduel->write_buffer8(target->current.controler);
......@@ -1840,7 +1846,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
return FALSE;
}
case 10: {
core.spsummoning_card = 0;
core.summoning_card = 0;
raise_event(target, EVENT_SPSUMMON, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0);
process_instant_event();
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, TRUE, TRUE);
......@@ -1865,7 +1871,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
if(target->is_status(STATUS_DISABLED))
target->reset(RESET_DISABLE, RESET_EVENT);
target->set_status(STATUS_PROC_COMPLETE | STATUS_SUMMON_TURN, TRUE);
core.spsummoning_card = 0;
core.summoning_card = 0;
return FALSE;
}
case 16: {
......@@ -1953,6 +1959,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
if(!targets)
core.special_summoning.insert(target);
target->enable_field_effect(FALSE);
target->set_status(STATUS_FLIP_SUMMONED, FALSE);
core.spsummoned_cards_pt[target->summon_player].insert(target);
core.spsummon_state[target->summon_player] = TRUE;
core.hint_timing[target->summon_player] |= TIMING_SPSUMMON;
......@@ -3084,6 +3091,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
trapmonster = true;
pcard->reset(RESET_TURN_SET, RESET_EVENT);
pcard->set_status(STATUS_SET_TURN, TRUE);
pcard->set_status(STATUS_FLIP_SUMMONED, FALSE);
pcard->enable_field_effect(FALSE);
}
if((npos & POS_FACEDOWN) && pcard->equiping_cards.size()) {
......
......@@ -4232,7 +4232,7 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
core.chain_limit_p = 0;
}
reset_chain();
if(core.summoning_card || core.spsummoning_card || core.effect_damage_step == 1)
if(core.summoning_card || core.effect_damage_step == 1)
core.subunits.push_back(core.reserved);
return FALSE;
}
......
......@@ -12,6 +12,7 @@ function c3643300.initial_effect(c)
--atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_IGNORE_BATTLE_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c3643300.econ)
......
--サンダーエンド·ドラゴン
--No.91 サンダー·スパーク·ドラゴン
function c84417082.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,4),3)
......@@ -31,15 +31,18 @@ function c84417082.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
e:GetHandler():RemoveOverlayCard(tp,3,3,REASON_COST)
end
function c84417082.filter1(c)
return c:IsFaceup() and c:IsDestructable()
end
function c84417082.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(84417082)==0
and Duel.IsExistingMatchingCard(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
and Duel.IsExistingMatchingCard(c84417082.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
e:GetHandler():RegisterFlagEffect(84417082,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
local g=Duel.GetMatchingGroup(c84417082.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c84417082.operation1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
local g=Duel.GetMatchingGroup(c84417082.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
Duel.Destroy(g,REASON_EFFECT)
end
function c84417082.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -24,10 +24,9 @@ function c9633505.initial_effect(c)
--atk
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e5:SetCode(EFFECT_IGNORE_BATTLE_TARGET)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetValue(1)
c:RegisterEffect(e5)
end
function c9633505.cfilter(c)
......
......@@ -117,7 +117,7 @@ STATUS_TO_ENABLE =0x0002 --
STATUS_TO_DISABLE =0x0004 --
STATUS_PROC_COMPLETE =0x0008 --
STATUS_SET_TURN =0x0010 --
STATUS_ACTIVATING =0x0020 --
STATUS_FLIP_SUMMONED =0x0020 --
STATUS_REVIVE_LIMIT =0x0040 --
STATUS_ATTACKED =0x0080 --
STATUS_FORM_CHANGED =0x0100 --
......@@ -422,6 +422,7 @@ EFFECT_NECRO_VALLEY_IM =293
EFFECT_REVERSE_DECK =294
EFFECT_REMOVE_BRAINWASHING =295
EFFECT_BP_TWICE =296
EFFECT_MATCH_KILL =300
EVENT_STARTUP =1000
EVENT_FLIP =1001
......
......@@ -370,6 +370,7 @@
!victory 0x14 「究极封印神 艾克佐迪奥斯」效果胜利
!victory 0x15 「通灵盘」效果胜利
!victory 0x16 「最终一战!」效果胜利
!victory 0x20 由于「%ls」的效果获得比赛胜利
#counters
!counter 0x3001 魔力指示物
!counter 0x2 楔指示物
......
......@@ -5,7 +5,7 @@ antialias = 2
errorlog = 1
nickname = Player
gamename = Game
lastdeck = sample
lastdeck = test
textfont = c:/windows/fonts/simsun.ttc 14
numfont = c:/windows/fonts/arialbd.ttf
serverport = 7911
......
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