Commit 3afeebf2 authored by mercury233's avatar mercury233
parents f3070210 eb1c8767
......@@ -452,6 +452,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_MATERIAL_LIMIT 361
#define EFFECT_SET_BATTLE_ATTACK 362
#define EFFECT_SET_BATTLE_DEFENSE 363
#define EFFECT_OVERLAY_RITUAL_MATERIAL 364
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -1868,6 +1868,9 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
if(pcard && pcard->is_affect_by_effect(peffect)
&& pcard->is_releasable_by_nonsummon(playerid) && pcard->is_releasable_by_effect(playerid, peffect))
material->insert(pcard);
if(pcard && pcard->is_affected_by_effect(EFFECT_OVERLAY_RITUAL_MATERIAL))
for(auto& mcard : pcard->xyz_materials)
material->insert(mcard);
}
for(auto& pcard : player[1 - playerid].list_mzone) {
if(pcard && pcard->is_affect_by_effect(peffect)
......@@ -1898,12 +1901,16 @@ void field::get_fusion_material(uint8 playerid, card_set* material) {
void field::ritual_release(card_set* material) {
card_set rel;
card_set rem;
card_set xyz;
for(auto& pcard : *material) {
if(pcard->current.location == LOCATION_GRAVE)
rem.insert(pcard);
else if(pcard->current.location == LOCATION_OVERLAY)
xyz.insert(pcard);
else
rel.insert(pcard);
}
send_to(&xyz, core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP);
release(&rel, core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player);
send_to(&rem, core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player, PLAYER_NONE, LOCATION_REMOVED, 0, POS_FACEUP);
}
......
......@@ -1161,6 +1161,28 @@ int32 scriptlib::card_is_summon_type(lua_State *L) {
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_summon_location(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**)lua_touserdata(L, 1);
uint32 tloc = (uint32)lua_tointeger(L, 2);
if(((pcard->summon_info >> 16) & 0xff) & tloc)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_summon_player(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**)lua_touserdata(L, 1);
uint32 con = (uint32)lua_tointeger(L, 2);
if(pcard->summon_player == con)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_status(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -2425,6 +2447,17 @@ int32 scriptlib::card_is_controler(lua_State *L) {
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_pre_controler(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 con = (uint32)lua_tointeger(L, 2);
if(pcard->previous.controler == con)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_onfield(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -3245,6 +3278,8 @@ static const struct luaL_Reg cardlib[] = {
{ "IsLinkAttribute", scriptlib::card_is_link_attribute },
{ "IsReason", scriptlib::card_is_reason },
{ "IsSummonType", scriptlib::card_is_summon_type },
{ "IsSummonLocation", scriptlib::card_is_summon_location },
{ "IsSummonPlayer", scriptlib::card_is_summon_player },
{ "IsStatus", scriptlib::card_is_status },
{ "IsNotTuner", scriptlib::card_is_not_tuner },
{ "SetStatus", scriptlib::card_set_status },
......@@ -3343,6 +3378,7 @@ static const struct luaL_Reg cardlib[] = {
{ "IsPosition", scriptlib::card_is_position },
{ "IsPreviousPosition", scriptlib::card_is_pre_position },
{ "IsControler", scriptlib::card_is_controler },
{ "IsPreviousControler", scriptlib::card_is_pre_controler },
{ "IsOnField", scriptlib::card_is_onfield },
{ "IsLocation", scriptlib::card_is_location },
{ "IsPreviousLocation", scriptlib::card_is_pre_location },
......
......@@ -1820,7 +1820,7 @@ int32 field::process_instant_event() {
}
}
}
if(ev.event_code == EVENT_ADJUST || ev.event_code == EVENT_BREAK_EFFECT || ((ev.event_code & 0xf000) == EVENT_PHASE_START))
if(ev.event_code == EVENT_ADJUST || ev.event_code == EVENT_BREAK_EFFECT || ((ev.event_code & 0xf000) == EVENT_PHASE_START) && ((ev.event_code & EVENT_CUSTOM) == 0))
continue;
//triggers
pr = effects.trigger_f_effect.equal_range(ev.event_code);
......@@ -3338,7 +3338,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
if(eset.size()) {
pierce = true;
uint8 dp[2] = {};
for(uint32 i = 0; i < eset.size(); ++i)
for(int32 i = 0; i < eset.size(); ++i)
dp[1 - eset[i]->get_handler_player()] = 1;
if(dp[0])
core.battle_damage[0] = a - d;
......@@ -3435,7 +3435,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
bool double_dam = false;
bool half_dam = false;
int32 dam_value = -1;
for(uint32 i = 0; i < eset.size(); ++i) {
for(int32 i = 0; i < eset.size(); ++i) {
int32 val = -1;
if(!eset[i]->is_flag(EFFECT_FLAG_PLAYER_TARGET)) {
pduel->lua->add_param(p, PARAM_TYPE_INT);
......@@ -3555,7 +3555,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
bool double_dam = false;
bool half_dam = false;
int32 dam_value = -1;
for(uint32 i = 0; i < eset.size(); ++i) {
for(int32 i = 0; i < eset.size(); ++i) {
int32 val = -1;
if(!eset[i]->is_flag(EFFECT_FLAG_PLAYER_TARGET)) {
pduel->lua->add_param(p, PARAM_TYPE_INT);
......
......@@ -123,6 +123,8 @@ public:
static int32 card_is_link_attribute(lua_State *L);
static int32 card_is_reason(lua_State *L);
static int32 card_is_summon_type(lua_State *L);
static int32 card_is_summon_location(lua_State *L);
static int32 card_is_summon_player(lua_State *L);
static int32 card_is_status(lua_State *L);
static int32 card_is_not_tuner(lua_State *L);
static int32 card_set_status(lua_State *L);
......@@ -221,6 +223,7 @@ public:
static int32 card_is_position(lua_State *L);
static int32 card_is_pre_position(lua_State *L);
static int32 card_is_controler(lua_State *L);
static int32 card_is_pre_controler(lua_State *L);
static int32 card_is_onfield(lua_State *L);
static int32 card_is_location(lua_State *L);
static int32 card_is_pre_location(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