Commit 5aa52f96 authored by salix5's avatar salix5 Committed by GitHub

fix #544 (#549)

* fix PROCESSOR_SUMMON_RULE

* fix PROCESSOR_FLIP_SUMMON

* fix PROCESSOR_MSET

* fix PROCESSOR_SPSUMMON_RULE

* edit comment
parent 3c1f5f3c
......@@ -22,6 +22,10 @@
#define MAX_COIN_COUNT 20
//summon action type
#define SUMMON_IN_IDLE 0
#define SUMMON_IN_CHAIN 1
class card;
struct card_data;
class duel;
......@@ -552,9 +556,9 @@ public:
void draw(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, int32 count);
void damage(effect* reason_effect, uint32 reason, uint32 reason_player, card* reason_card, uint32 playerid, int32 amount, uint32 is_step = FALSE);
void recover(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, int32 amount, uint32 is_step = FALSE);
void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f);
void mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f);
void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type);
void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE);
void mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE);
void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type = SUMMON_IN_IDLE);
void special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_complete(effect* reason_effect, uint8 reason_player);
......@@ -708,10 +712,6 @@ public:
#define GLOBALFLAG_ACTIVATION_COUNT 0x800
//
//summon action type
#define SUMMON_IN_IDLE 0
#define SUMMON_IN_CHAIN 1
#define PROCESSOR_ADJUST 1
#define PROCESSOR_HINT 2
#define PROCESSOR_TURN 3
......@@ -755,17 +755,17 @@ public:
#define PROCESSOR_DESTROY_REPLACE 56
#define PROCESSOR_RELEASE_REPLACE 57
#define PROCESSOR_SENDTO_REPLACE 58
#define PROCESSOR_SUMMON_RULE 60
#define PROCESSOR_SPSUMMON_RULE 61
#define PROCESSOR_SUMMON_RULE 60 //arg1: arguments, arg2: max, arg3: releasable, arg4: arguments
#define PROCESSOR_SPSUMMON_RULE 61 //arg1: arguments, arg2: arguments, arg3: arguments
#define PROCESSOR_SPSUMMON 62
#define PROCESSOR_FLIP_SUMMON 63
#define PROCESSOR_MSET 64
#define PROCESSOR_FLIP_SUMMON 63 //arg1: arguments, arg2: arguments
#define PROCESSOR_MSET 64 //arg1: arguments, arg2: max, arg3: arguments
#define PROCESSOR_SSET 65
#define PROCESSOR_SPSUMMON_STEP 66
#define PROCESSOR_SSET_G 67
#define PROCESSOR_DRAW 70
#define PROCESSOR_DAMAGE 71
#define PROCESSOR_RECOVER 72
#define PROCESSOR_DAMAGE 71 //arg1: arguments, arg2: arguments, arg3: arguments
#define PROCESSOR_RECOVER 72 //arg1: arguments, arg2: arguments, arg3: arguments
#define PROCESSOR_EQUIP 73
#define PROCESSOR_GET_CONTROL 74
#define PROCESSOR_SWAP_CONTROL 75
......
......@@ -299,13 +299,15 @@ int32 scriptlib::duel_summon(lua_State *L) {
if(lua_gettop(L) >= 6)
zone = (uint32)lua_tointeger(L, 6);
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->summon(playerid, pcard, peffect, ignore_count, min_tribute, zone);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->summon(playerid, pcard, peffect, ignore_count, min_tribute, zone, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->summon(playerid, pcard, peffect, ignore_count, min_tribute, zone, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_special_summon_rule(lua_State *L) {
......@@ -323,13 +325,15 @@ int32 scriptlib::duel_special_summon_rule(lua_State *L) {
if(lua_gettop(L) >= 3)
sumtype = (uint32)lua_tointeger(L, 3);
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->special_summon_rule(playerid, pcard, sumtype);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->special_summon_rule(playerid, pcard, sumtype, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->special_summon_rule(playerid, pcard, sumtype, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_synchro_summon(lua_State *L) {
......@@ -368,13 +372,15 @@ int32 scriptlib::duel_synchro_summon(lua_State *L) {
pduel->game_field->core.limit_syn_minc = minc;
pduel->game_field->core.limit_syn_maxc = maxc;
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_SYNCHRO);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_SYNCHRO, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_SYNCHRO, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_xyz_summon(lua_State *L) {
......@@ -405,13 +411,15 @@ int32 scriptlib::duel_xyz_summon(lua_State *L) {
pduel->game_field->core.limit_xyz_minc = minc;
pduel->game_field->core.limit_xyz_maxc = maxc;
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_XYZ);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_XYZ, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_XYZ, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_link_summon(lua_State *L) {
......@@ -450,13 +458,15 @@ int32 scriptlib::duel_link_summon(lua_State *L) {
pduel->game_field->core.limit_link_minc = minc;
pduel->game_field->core.limit_link_maxc = maxc;
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_LINK);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_LINK, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_LINK, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_setm(lua_State *L) {
......@@ -483,13 +493,15 @@ int32 scriptlib::duel_setm(lua_State *L) {
if(lua_gettop(L) >= 6)
zone = (uint32)lua_tointeger(L, 6);
pduel->game_field->core.summon_cancelable = FALSE;
pduel->game_field->mset(playerid, pcard, peffect, ignore_count, min_tribute, zone);
if(pduel->game_field->core.current_chain.size()) {
pduel->game_field->mset(playerid, pcard, peffect, ignore_count, min_tribute, zone, SUMMON_IN_CHAIN);
pduel->game_field->core.summon_reserved = pduel->game_field->core.subunits.back();
pduel->game_field->core.summon_reserved.arg3 = SUMMON_IN_CHAIN;
pduel->game_field->core.subunits.pop_back();
pduel->game_field->core.summoning_card = pcard;
}
else {
pduel->game_field->mset(playerid, pcard, peffect, ignore_count, min_tribute, zone, SUMMON_IN_IDLE);
}
return lua_yield(L, 0);
}
int32 scriptlib::duel_sets(lua_State *L) {
......
......@@ -152,14 +152,14 @@ void field::damage(effect* reason_effect, uint32 reason, uint32 reason_player, c
void field::recover(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, int32 amount, uint32 is_step) {
add_process(PROCESSOR_RECOVER, 0, reason_effect, 0, reason, (is_step << 4) + (reason_player << 2) + (playerid), amount);
}
void field::summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone) {
add_process(PROCESSOR_SUMMON_RULE, 0, proc, (group*)target, sumplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24), 0);
void field::summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone, uint32 action_type) {
add_process(PROCESSOR_SUMMON_RULE, 0, proc, (group*)target, sumplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24), 0, 0, action_type);
}
void field::mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone) {
add_process(PROCESSOR_MSET, 0, proc, (group*)target, setplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24), 0);
void field::mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone, uint32 action_type) {
add_process(PROCESSOR_MSET, 0, proc, (group*)target, setplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24), 0, action_type);
}
void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type) {
add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type);
void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type) {
add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type, action_type);
}
void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) {
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
......
......@@ -364,7 +364,7 @@ uint32 field::process() {
return pduel->message_buffer.size();
}
case PROCESSOR_SUMMON_RULE: {
if (summon(it->step, it->arg1 & 0xff, (card*)it->ptarget, it->peffect, (it->arg1 >> 8) & 0xff, (it->arg1 >> 16) & 0xff, (it->arg1 >> 24) & 0xff, it->arg3))
if (summon(it->step, it->arg1 & 0xff, (card*)it->ptarget, it->peffect, (it->arg1 >> 8) & 0xff, (it->arg1 >> 16) & 0xff, (it->arg1 >> 24) & 0xff, it->arg4))
core.units.pop_front();
else
++it->step;
......@@ -385,7 +385,7 @@ uint32 field::process() {
return pduel->message_buffer.size();
}
case PROCESSOR_FLIP_SUMMON: {
if (flip_summon(it->step, it->arg1, (card*)(it->ptarget), it->arg3))
if (flip_summon(it->step, it->arg1, (card*)(it->ptarget), it->arg2))
core.units.pop_front();
else
++it->step;
......
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