Commit 7e80a9e7 authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent 8c897791
...@@ -629,6 +629,7 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -629,6 +629,7 @@ std::pair<int32, int32> card::get_atk_def() {
effect_set eset; effect_set eset;
effect_set effects_atk_final, effects_atk_wicked, effects_atk_option; effect_set effects_atk_final, effects_atk_wicked, effects_atk_option;
effect_set effects_def_final, effects_def_wicked, effects_def_option; effect_set effects_def_final, effects_def_wicked, effects_def_option;
effect_set effects_repeat_update_atk, effects_repeat_update_def;
int32 batk = data.attack; int32 batk = data.attack;
if (batk < 0) if (batk < 0)
batk = 0; batk = 0;
...@@ -682,7 +683,9 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -682,7 +683,9 @@ std::pair<int32, int32> card::get_atk_def() {
for (int32 i = 0; i < eset.size(); ++i) { for (int32 i = 0; i < eset.size(); ++i) {
switch (eset[i]->code) { switch (eset[i]->code) {
case EFFECT_UPDATE_ATTACK: case EFFECT_UPDATE_ATTACK:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) if (eset[i]->is_flag(EFFECT_FLAG2_REPEAT_UPDATE))
effects_repeat_update_atk.add_item(eset[i]);
else if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE))
up_atk += eset[i]->get_value(this); up_atk += eset[i]->get_value(this);
else else
upc_atk += eset[i]->get_value(this); upc_atk += eset[i]->get_value(this);
...@@ -713,7 +716,9 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -713,7 +716,9 @@ std::pair<int32, int32> card::get_atk_def() {
break; break;
// def // def
case EFFECT_UPDATE_DEFENSE: case EFFECT_UPDATE_DEFENSE:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) if (eset[i]->is_flag(EFFECT_FLAG2_REPEAT_UPDATE))
effects_repeat_update_def.add_item(eset[i]);
else if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE))
up_def += eset[i]->get_value(this); up_def += eset[i]->get_value(this);
else else
upc_def += eset[i]->get_value(this); upc_def += eset[i]->get_value(this);
...@@ -759,6 +764,16 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -759,6 +764,16 @@ std::pair<int32, int32> card::get_atk_def() {
if (temp.defense < 0) if (temp.defense < 0)
temp.defense = 0; temp.defense = 0;
} }
for (int32 i = 0; i < effects_repeat_update_atk.size(); ++i) {
temp.attack += effects_repeat_update_atk[i]->get_value(this);
if (temp.attack < 0)
temp.attack = 0;
}
for (int32 i = 0; i < effects_repeat_update_def.size(); ++i) {
temp.defense += effects_repeat_update_def[i]->get_value(this);
if (temp.defense < 0)
temp.defense = 0;
}
for (int32 i = 0; i < effects_atk_final.size(); ++i) { for (int32 i = 0; i < effects_atk_final.size(); ++i) {
atk = effects_atk_final[i]->get_value(this); atk = effects_atk_final[i]->get_value(this);
if (atk < 0) if (atk < 0)
...@@ -3438,8 +3453,10 @@ int32 card::is_affect_by_effect(effect* reason_effect) { ...@@ -3438,8 +3453,10 @@ int32 card::is_affect_by_effect(effect* reason_effect) {
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
int32 card::is_can_be_disabled_by_effect(effect* reason_effect) { int32 card::is_can_be_disabled_by_effect(effect* reason_effect, bool is_monster_effect) {
if (is_status(STATUS_DISABLED)) if (is_monster_effect && is_status(STATUS_DISABLED))
return FALSE;
if(!is_monster_effect && !(get_type() & TYPE_TRAPMONSTER) && is_status(STATUS_DISABLED))
return FALSE; return FALSE;
if (is_affected_by_effect(EFFECT_CANNOT_DISABLE)) if (is_affected_by_effect(EFFECT_CANNOT_DISABLE))
return FALSE; return FALSE;
......
...@@ -204,7 +204,7 @@ enum effect_flag : uint32 { ...@@ -204,7 +204,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000, EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000,
}; };
enum effect_flag2 : uint32 { enum effect_flag2 : uint32 {
// EFFECT_FLAG2_MILLENNIUM_RESTRICT = 0x0001, EFFECT_FLAG2_REPEAT_UPDATE = 0x0001,
EFFECT_FLAG2_COF = 0x0002, EFFECT_FLAG2_COF = 0x0002,
EFFECT_FLAG2_WICKED = 0x0004, EFFECT_FLAG2_WICKED = 0x0004,
EFFECT_FLAG2_OPTION = 0x0008, EFFECT_FLAG2_OPTION = 0x0008,
......
...@@ -3004,7 +3004,10 @@ int32 scriptlib::card_is_can_be_disabled_by_effect(lua_State* L) { ...@@ -3004,7 +3004,10 @@ int32 scriptlib::card_is_can_be_disabled_by_effect(lua_State* L) {
check_param(L, PARAM_TYPE_EFFECT, 2); check_param(L, PARAM_TYPE_EFFECT, 2);
card* pcard = *(card**)lua_touserdata(L, 1); card* pcard = *(card**)lua_touserdata(L, 1);
effect* peffect = *(effect**)lua_touserdata(L, 2); effect* peffect = *(effect**)lua_touserdata(L, 2);
lua_pushboolean(L, pcard->is_can_be_disabled_by_effect(peffect)); bool is_monster_effect = true;
if (lua_gettop(L) > 2)
is_monster_effect = lua_toboolean(L, 3);
lua_pushboolean(L, pcard->is_can_be_disabled_by_effect(peffect, is_monster_effect));
return 1; return 1;
} }
int32 scriptlib::card_is_can_be_effect_target(lua_State *L) { int32 scriptlib::card_is_can_be_effect_target(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