Skip to content

Commit

Permalink
Prevent unusually high base damage
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed Nov 29, 2017
1 parent cb82ad4 commit 361b3b4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions _work/data/Scripts/Content/GFA/_intern/collision.d
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,22 @@ func void GFA_CC_SetDamageBehavior() {
// Calculate new base damage from adjusted newFinalDamage
var int newBaseDamage;
if (GOTHIC_BASE_VERSION == 1) {
newBaseDamage = newFinalDamage+protection;
// If new final damage is zero, the new base damage is also
if (newFinalDamage) {
newBaseDamage = newFinalDamage+protection;
} else {
newBaseDamage = 0;
};
} else {
newBaseDamage = (newFinalDamage+protection)-hero.attribute[ATR_DEXTERITY];
// If new final damage is less that NPC_MINIMAL_DAMAGE, the new base damage stays zero
if (newFinalDamage > NPC_MINIMAL_DAMAGE) {
newBaseDamage = (newFinalDamage+protection)-hero.attribute[ATR_DEXTERITY];
} else {
newBaseDamage = 0;
};
};

// If the new base damage is below zero, increase the hit points to balance out the final damage
if (newBaseDamage < 0) {
targetNpc.attribute[ATR_HITPOINTS] += -newBaseDamage;
newBaseDamage = 0;
Expand Down

0 comments on commit 361b3b4

Please sign in to comment.