Skip to content

Commit

Permalink
feat: make mobs more likely to flee
Browse files Browse the repository at this point in the history
  • Loading branch information
kiedtl committed Feb 9, 2023
1 parent 30d1f63 commit 76dee13
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ai.zig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn currentEnemy(me: *Mob) *EnemyRecord {
}

pub fn calculateMorale(self: *Mob) isize {
var base: isize = 6;
var base: isize = 5;

// Bonuses depending on self's condition {{{
if (self.hasStatus(.Enraged)) base += 4;
Expand All @@ -88,8 +88,8 @@ pub fn calculateMorale(self: *Mob) isize {
// properly canceled out by the fact that the mob themself is also
// below 50% health
//
if (self.HP < (self.max_HP / 2)) base -= 2;
if (self.HP < (self.max_HP / 4)) base -= 2;
if (self.HP < (self.max_HP / 2)) base -= 3;
if (self.HP < (self.max_HP / 4)) base -= 3;

if (self.hasStatus(.Blind)) base -= 2;
if (self.hasStatus(.Debil)) base -= 2;
Expand All @@ -115,11 +115,11 @@ pub fn calculateMorale(self: *Mob) isize {
for (self.enemyList().items) |enemy_record| {
const enemy = enemy_record.mob;

if (enemy.hasStatus(.Intimidating)) base -= 12;
if (enemy.hasStatus(.Intimidating)) base -= 10;

if (enemy.hasStatus(.Enraged)) base -= 4;
if (enemy.hasStatus(.Fast)) base -= 4;
if (enemy.hasStatus(.Invigorate)) base -= 4;
if (enemy.hasStatus(.Enraged)) base -= 3;
if (enemy.hasStatus(.Fast)) base -= 3;
if (enemy.hasStatus(.Invigorate)) base -= 3;

if (enemy.hasStatus(.Sleeping)) base += 2;
if (enemy.hasStatus(.Blind)) base += 2;
Expand All @@ -142,7 +142,7 @@ pub fn calculateMorale(self: *Mob) isize {
// properly canceled out by the fact that the mob themself is also
// below 50% health
//
if (enemy.HP < (enemy.max_HP / 2)) base += 4;
if (enemy.HP < (enemy.max_HP / 2)) base += 3;
if (enemy.HP < (enemy.max_HP / 4)) base += 4;

if (enemy.ai.phase == .Flee) base += 6;
Expand Down

0 comments on commit 76dee13

Please sign in to comment.