Commit 570a29eb authored by Chen Bill's avatar Chen Bill Committed by GitHub

add EFFECT_FLAG2_REPEAT_UPDATE (#487)

parent b6d8b0e9
...@@ -625,6 +625,7 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -625,6 +625,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;
...@@ -678,7 +679,9 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -678,7 +679,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);
...@@ -709,7 +712,9 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -709,7 +712,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);
...@@ -755,6 +760,16 @@ std::pair<int32, int32> card::get_atk_def() { ...@@ -755,6 +760,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)
......
...@@ -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,
......
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