Commit 92a9867c authored by mercury233's avatar mercury233

update ocgcore

parent 89299a43
......@@ -2943,28 +2943,48 @@ int32 card::check_cost_condition(int32 ecode, int32 playerid) {
effect_set eset;
pduel->game_field->filter_player_effect(playerid, ecode, &eset, FALSE);
filter_effect(ecode, &eset);
int32 res = TRUE;
effect* oreason = pduel->game_field->core.reason_effect;
uint8 op = pduel->game_field->core.reason_player;
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
effect* peffect = eset[i];
pduel->game_field->core.reason_effect = peffect;
pduel->game_field->core.reason_player = playerid;
pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
if(!pduel->lua->check_condition(eset[i]->cost, 3))
return FALSE;
if(!pduel->lua->check_condition(peffect->cost, 3)) {
res = FALSE;
break;
}
}
return TRUE;
pduel->game_field->core.reason_effect = oreason;
pduel->game_field->core.reason_player = op;
return res;
}
int32 card::check_cost_condition(int32 ecode, int32 playerid, int32 sumtype) {
effect_set eset;
pduel->game_field->filter_player_effect(playerid, ecode, &eset, FALSE);
filter_effect(ecode, &eset);
int32 res = TRUE;
effect* oreason = pduel->game_field->core.reason_effect;
uint8 op = pduel->game_field->core.reason_player;
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
effect* peffect = eset[i];
pduel->game_field->core.reason_effect = peffect;
pduel->game_field->core.reason_player = playerid;
pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(sumtype, PARAM_TYPE_INT);
if(!pduel->lua->check_condition(eset[i]->cost, 4))
return FALSE;
if(!pduel->lua->check_condition(peffect->cost, 4)) {
res = FALSE;
break;
}
}
return TRUE;
pduel->game_field->core.reason_effect = oreason;
pduel->game_field->core.reason_player = op;
return res;
}
int32 card::is_summonable_card() {
if(!(data.type & TYPE_MONSTER))
......@@ -3236,7 +3256,7 @@ int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, ui
if((data.type & TYPE_PENDULUM) && current.location == LOCATION_EXTRA && (current.position & POS_FACEUP)
&& (sumtype == SUMMON_TYPE_FUSION || sumtype == SUMMON_TYPE_SYNCHRO || sumtype == SUMMON_TYPE_XYZ))
return FALSE;
if((sumpos & POS_FACEDOWN) && pduel->game_field->is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
if((sumpos & POS_FACEDOWN) && pduel->game_field->is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
sumpos = (sumpos & POS_FACEUP) | ((sumpos & POS_FACEDOWN) >> 1);
if(!(sumpos & POS_FACEDOWN) && pduel->game_field->check_unique_onfield(this, toplayer, LOCATION_MZONE))
return FALSE;
......
......@@ -240,7 +240,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_EXTRA_SET_COUNT 35 //
#define EFFECT_SET_PROC 36 //
#define EFFECT_LIMIT_SET_PROC 37 //
#define EFFECT_DEVINE_LIGHT 38 //
#define EFFECT_DIVINE_LIGHT 38 //
#define EFFECT_CANNOT_DISABLE_FLIP_SUMMON 39 //
#define EFFECT_INDESTRUCTABLE 40 //
#define EFFECT_INDESTRUCTABLE_EFFECT 41 //
......
......@@ -1048,6 +1048,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
++clit;
}
for(auto& pcard : player[playerid].list_grave) {
pcard->current.position = POS_FACEUP;
pcard->current.location = LOCATION_GRAVE;
pcard->current.reason = REASON_EFFECT;
pcard->current.reason_effect = core.reason_effect;
......@@ -1057,6 +1058,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
pcard->reset(RESET_TOGRAVE, RESET_EVENT);
}
for(auto& pcard : player[playerid].list_main) {
pcard->current.position = POS_FACEDOWN_DEFENSE;
pcard->current.location = LOCATION_DECK;
pcard->current.reason = REASON_EFFECT;
pcard->current.reason_effect = core.reason_effect;
......@@ -1066,6 +1068,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
pcard->reset(RESET_TODECK, RESET_EVENT);
}
for(auto& pcard : ex) {
pcard->current.position = POS_FACEDOWN_DEFENSE;
pcard->current.location = LOCATION_EXTRA;
pcard->current.reason = REASON_EFFECT;
pcard->current.reason_effect = core.reason_effect;
......@@ -1074,7 +1077,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
pcard->enable_field_effect(true);
pcard->reset(RESET_TODECK, RESET_EVENT);
}
player[playerid].list_extra.insert(player[playerid].list_extra.end(), ex.begin(), ex.end());
player[playerid].list_extra.insert(player[playerid].list_extra.end() - player[playerid].extra_p_count, ex.begin(), ex.end());
reset_sequence(playerid, LOCATION_GRAVE);
reset_sequence(playerid, LOCATION_EXTRA);
pduel->write_buffer8(MSG_SWAP_GRAVE_DECK);
......@@ -3057,7 +3060,7 @@ int32 field::is_player_can_spsummon(effect* reason_effect, uint32 sumtype, uint8
return FALSE;
}
restore_lp_cost();
if(sumpos & POS_FACEDOWN && is_player_affected_by_effect(playerid, EFFECT_DEVINE_LIGHT))
if(sumpos & POS_FACEDOWN && is_player_affected_by_effect(playerid, EFFECT_DIVINE_LIGHT))
sumpos = (sumpos & POS_FACEUP) | ((sumpos & POS_FACEDOWN) >> 1);
effect_set eset;
filter_player_effect(playerid, EFFECT_CANNOT_SPECIAL_SUMMON, &eset);
......
......@@ -159,7 +159,7 @@ void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_ty
add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_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_DEVINE_LIGHT))
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
positions = (positions & POS_FACEUP) | ((positions & POS_FACEDOWN) >> 1);
for(auto& pcard : *target) {
pcard->temp.reason = pcard->current.reason;
......@@ -177,7 +177,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u
add_process(PROCESSOR_SPSUMMON, 0, core.reason_effect, pgroup, core.reason_player, zone);
}
void field::special_summon_step(card* 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_DEVINE_LIGHT))
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
positions = (positions & POS_FACEUP) | ((positions & POS_FACEDOWN) >> 1);
target->temp.reason = target->current.reason;
target->temp.reason_effect = target->current.reason_effect;
......@@ -1761,7 +1761,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
case 8: {
uint8 targetplayer = sumplayer;
uint8 positions = POS_FACEUP_ATTACK;
if(is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
if(is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
positions = POS_FACEUP;
if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
positions = (uint8)proc->s_range & POS_FACEUP;
......
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