Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Oct 5, 2024
1 parent e7f25ab commit e7b79df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ card::AtkDef card::get_atk_def() {
effect_set eset;
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_repeat_update_atk, effects_repeat_update_def;
if(batk < 0)
batk = 0;
if(bdef < 0)
Expand Down Expand Up @@ -698,8 +699,9 @@ card::AtkDef card::get_atk_def() {
for(const auto& peffect : eset) {
switch(peffect->code) {
case EFFECT_UPDATE_ATTACK: {
auto value = peffect->get_value(this);
if((peffect->type & EFFECT_TYPE_SINGLE) && !peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE))
if(peffect->is_flag(EFFECT_FLAG2_REPEAT_ATK_DEF_UPDATE))
effects_repeat_update_atk.push_back(peffect);
else if(auto value = peffect->get_value(this); (peffect->type & EFFECT_TYPE_SINGLE) && !peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE))
up_atk += value;
else
upc_atk += value;
Expand All @@ -723,8 +725,9 @@ card::AtkDef card::get_atk_def() {
}
break;
case EFFECT_UPDATE_DEFENSE: {
auto value = peffect->get_value(this);
if((peffect->type & EFFECT_TYPE_SINGLE) && !peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE))
if(peffect->is_flag(EFFECT_FLAG2_REPEAT_ATK_DEF_UPDATE))
effects_repeat_update_def.push_back(peffect);
else if(auto value = peffect->get_value(this); (peffect->type & EFFECT_TYPE_SINGLE) && !peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE))
up_def += value;
else
upc_def += value;
Expand Down Expand Up @@ -763,6 +766,12 @@ card::AtkDef card::get_atk_def() {
if(temp.defense < 0)
temp.defense = 0;
}
for(const auto& peffect : effects_repeat_update_atk) {
temp.attack = std::max(0, static_cast<int32_t>(temp.attack + peffect->get_value(this)));
}
for(const auto& peffect : effects_repeat_update_def) {
temp.defense = std::max(0, static_cast<int32_t>(temp.defense + peffect->get_value(this)));
}
for(const auto& peffect : effects_atk_final) {
temp.attack = std::max(0, static_cast<int32_t>(peffect->get_value(this)));
}
Expand Down
1 change: 1 addition & 0 deletions effect_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum effect_flag2 : uint32_t {
EFFECT_FLAG2_CHECK_SIMULTANEOUS = 0x0004,
EFFECT_FLAG2_WICKED = 0x0008,
EFFECT_FLAG2_OPTION = 0x0010,
EFFECT_FLAG2_REPEAT_ATK_DEF_UPDATE = 0x0020,
EFFECT_FLAG2_FORCE_ACTIVATE_LOCATION = 0x40000000,
EFFECT_FLAG2_MAJESTIC_MUST_COPY = 0x80000000,
};
Expand Down

0 comments on commit e7b79df

Please sign in to comment.