Skip to content

Commit

Permalink
Fix handling of piercing damage modifiers
Browse files Browse the repository at this point in the history
Effect value is now properly full 64 bit, no longer static cast the double/half damage constants to int32
  • Loading branch information
edo9300 committed Dec 9, 2023
1 parent 6dc321d commit 0c003e9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3701,7 +3701,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
bool double_damage = false;
//bool half_damage = false;
for(const auto& peff : eset) {
if(peff->get_value() == static_cast<int32_t>(DOUBLE_DAMAGE))
if(peff->get_value() == DOUBLE_DAMAGE)
double_damage = true;
//if(peff->get_value() == HALF_DAMAGE)
// half_damage = true;
Expand Down Expand Up @@ -3790,7 +3790,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
bool half_dam = false;
int32_t dam_value = -1;
for(const auto& peff : eset) {
int32_t val = -1;
lua_Integer val = -1;
if(!peff->is_flag(EFFECT_FLAG_PLAYER_TARGET)) {
pduel->lua->add_param<LuaParam::INT>(p);
pduel->lua->add_param<LuaParam::CARD>(core.attacker);
Expand All @@ -3803,10 +3803,10 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
dam_value = 0;
break;
} else if(val > 0)
dam_value = val;
else if(val == static_cast<int32_t>(DOUBLE_DAMAGE))
dam_value = static_cast<int32_t>(val);
else if(val == DOUBLE_DAMAGE)
double_dam = true;
else if(val == static_cast<int32_t>(HALF_DAMAGE))
else if(val == HALF_DAMAGE)
half_dam = true;
}
if(double_dam && half_dam) {
Expand Down Expand Up @@ -3913,7 +3913,7 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
bool half_dam = false;
int32_t dam_value = -1;
for(const auto& peff : eset) {
int32_t val = -1;
lua_Integer val = -1;
if(!peff->is_flag(EFFECT_FLAG_PLAYER_TARGET)) {
pduel->lua->add_param<LuaParam::INT>(p);
pduel->lua->add_param<LuaParam::CARD>(reason_card);
Expand All @@ -3926,10 +3926,10 @@ void field::calculate_battle_damage(effect** pdamchange, card** preason_card, ui
dam_value = 0;
break;
} else if(val > 0)
dam_value = val;
else if(val == static_cast<int32_t>(DOUBLE_DAMAGE))
dam_value = static_cast<int32_t>(val);
else if(val == DOUBLE_DAMAGE)
double_dam = true;
else if(val == static_cast<int32_t>(HALF_DAMAGE))
else if(val == HALF_DAMAGE)
half_dam = true;
}
if(double_dam && half_dam) {
Expand Down

0 comments on commit 0c003e9

Please sign in to comment.