Commit e8ce8c55 authored by Argon's avatar Argon

summon location

parent ac044801
......@@ -94,7 +94,7 @@ public:
query_cache q_cache;
uint8 owner;
uint8 summon_player;
uint32 summon_type;
uint32 summon_info;
uint32 status;
uint32 operation_param;
uint8 announce_count;
......
......@@ -63,6 +63,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetSequence", scriptlib::card_get_sequence },
{ "GetPreviousSequence", scriptlib::card_get_previous_sequence },
{ "GetSummonType", scriptlib::card_get_summon_type },
{ "GetSummonLocation", scriptlib::card_get_summon_location },
{ "GetSummonPlayer", scriptlib::card_get_summon_player },
{ "GetDestination", scriptlib::card_get_destination },
{ "GetLeaveFieldDest", scriptlib::card_get_leave_field_dest },
......
......@@ -366,7 +366,14 @@ int32 scriptlib::card_get_summon_type(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->summon_type);
lua_pushinteger(L, pcard->summon_info & 0xff00ffff);
return 1;
}
int32 scriptlib::card_get_summon_location(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, (pcard->summon_info >> 16) & 0xff);
return 1;
}
int32 scriptlib::card_get_summon_player(lua_State *L) {
......
......@@ -140,7 +140,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u
pcard->temp.reason = pcard->current.reason;
pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player;
pcard->summon_type = (sumtype & 0xfffffff) | SUMMON_TYPE_SPECIAL;
pcard->summon_info = (sumtype & 0xf00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)pcard->current.location << 16);
pcard->summon_player = sumplayer;
pcard->current.reason = REASON_SPSUMMON;
pcard->current.reason_effect = core.reason_effect;
......@@ -158,7 +158,7 @@ void field::special_summon_step(card* target, uint32 sumtype, uint32 sumplayer,
target->temp.reason = target->current.reason;
target->temp.reason_effect = target->current.reason_effect;
target->temp.reason_player = target->current.reason_player;
target->summon_type = (sumtype & 0xfffffff) | SUMMON_TYPE_SPECIAL;
target->summon_info = (sumtype & 0xf00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)target->current.location << 16);
target->summon_player = sumplayer;
target->current.reason = REASON_SPSUMMON;
target->current.reason_effect = core.reason_effect;
......@@ -1270,19 +1270,19 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
target->set_material(&tributes);
release(&tributes, 0, REASON_SUMMON | REASON_MATERIAL, sumplayer);
if(tributes.size())
target->summon_type = SUMMON_TYPE_NORMAL | SUMMON_TYPE_ADVANCE;
target->summon_info = SUMMON_TYPE_NORMAL | SUMMON_TYPE_ADVANCE | (LOCATION_HAND << 16);
else
target->summon_type = SUMMON_TYPE_NORMAL;
target->summon_info = SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
adjust_all();
} else
target->summon_type = SUMMON_TYPE_NORMAL;
target->summon_info = SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
target->current.reason_effect = 0;
target->current.reason_player = sumplayer;
core.units.begin()->step = 4;
return FALSE;
}
case 4: {
target->summon_type = (proc->get_value(target) & 0xfffffff) | SUMMON_TYPE_NORMAL;
target->summon_info = (proc->get_value(target) & 0xfffffff) | SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
target->current.reason_effect = proc;
target->current.reason_player = sumplayer;
if(proc->operation) {
......@@ -1684,12 +1684,12 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
target->set_material(&tributes);
release(&tributes, 0, REASON_SUMMON | REASON_MATERIAL, setplayer);
if(tributes.size())
target->summon_type = SUMMON_TYPE_NORMAL | SUMMON_TYPE_ADVANCE;
target->summon_info = SUMMON_TYPE_NORMAL | SUMMON_TYPE_ADVANCE | (LOCATION_HAND << 16);
else
target->summon_type = SUMMON_TYPE_NORMAL;
target->summon_info = SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
adjust_all();
} else
target->summon_type = SUMMON_TYPE_NORMAL;
target->summon_info = SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
target->summon_player = setplayer;
target->current.reason_effect = 0;
target->current.reason_player = setplayer;
......@@ -1697,7 +1697,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
return FALSE;
}
case 4: {
target->summon_type = (proc->get_value(target) & 0xfffffff) | SUMMON_TYPE_NORMAL;
target->summon_info = (proc->get_value(target) & 0xfffffff) | SUMMON_TYPE_NORMAL | (LOCATION_HAND << 16);
target->current.reason_effect = proc;
target->current.reason_player = setplayer;
pduel->lua->add_param(target, PARAM_TYPE_CARD);
......@@ -1968,7 +1968,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
core.units.begin()->step = 19;
return FALSE;
}
target->summon_type = (peffect->get_value(target) & 0xfffffff) | SUMMON_TYPE_SPECIAL;
target->summon_info = (peffect->get_value(target) & 0xf00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)target->current.location << 16);
if(peffect->operation) {
pduel->lua->add_param(target, PARAM_TYPE_CARD);
if(core.limit_tuner || core.limit_syn) {
......@@ -2162,12 +2162,12 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
effect* peffect = core.units.begin()->peffect;
card* pcard = *core.units.begin()->ptarget->it;
pcard->enable_field_effect(FALSE);
move_to_field(pcard, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP);
pcard->current.reason = REASON_SPSUMMON;
pcard->current.reason_effect = peffect;
pcard->current.reason_player = sumplayer;
pcard->summon_player = sumplayer;
pcard->summon_type = (peffect->get_value(pcard) & 0xfffffff) | SUMMON_TYPE_SPECIAL;
pcard->summon_info = (peffect->get_value(pcard) & 0xf00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)target->current.location << 16);
move_to_field(pcard, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP);
return FALSE;
}
case 24: {
......@@ -2269,7 +2269,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
}
if(!result || (target->current.location == LOCATION_MZONE)
|| check_unique_onfield(target, playerid)
|| !is_player_can_spsummon(core.reason_effect, target->summon_type, positions, target->summon_player, playerid, target)
|| !is_player_can_spsummon(core.reason_effect, target->summon_info & 0xff000000, positions, target->summon_player, playerid, target)
|| target->is_affected_by_effect(EFFECT_CANNOT_SPECIAL_SUMMON)
|| get_useable_count(playerid, LOCATION_MZONE, target->summon_player, LOCATION_REASON_TOFIELD) <= 0
|| (!nocheck && !(target->data.type & TYPE_MONSTER)))
......@@ -2279,7 +2279,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(target->summon_player, PARAM_TYPE_INT);
pduel->lua->add_param(target->summon_type, PARAM_TYPE_INT);
pduel->lua->add_param(target->summon_info & 0xff00ffff, PARAM_TYPE_INT);
pduel->lua->add_param(positions, PARAM_TYPE_INT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
if(!eset[i]->check_value_condition(5)) {
......@@ -2364,7 +2364,7 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
if(!((*cit)->current.position & POS_FACEDOWN))
raise_single_event(*cit, 0, EVENT_SPSUMMON_SUCCESS, (*cit)->current.reason_effect, 0, (*cit)->current.reason_player, (*cit)->summon_player, 0);
int32 summontype = (*cit)->summon_type & 0xff000000;
int32 summontype = (*cit)->summon_info & 0xff000000;
if(summontype && (*cit)->material_cards.size()) {
int32 matreason = (summontype == SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype == SUMMON_TYPE_RITUAL) ? REASON_RITUAL : (summontype == SUMMON_TYPE_XYZ) ? REASON_XYZ : 0;
for(auto mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit)
......
......@@ -65,6 +65,7 @@ public:
static int32 card_get_sequence(lua_State *L);
static int32 card_get_previous_sequence(lua_State *L);
static int32 card_get_summon_type(lua_State *L);
static int32 card_get_summon_location(lua_State *L);
static int32 card_get_summon_player(lua_State *L);
static int32 card_get_destination(lua_State *L);
static int32 card_get_leave_field_dest(lua_State *L);
......
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