Skip to content

Commit

Permalink
Merge pull request #13 from houghta4/master
Browse files Browse the repository at this point in the history
give delay to same tick manticores fixes issue #2
  • Loading branch information
Supalosa authored Aug 2, 2024
2 parents f69893f + e55f8b2 commit 2516427
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const MANTICORE_PATTERNS: { [patternName: string]: number[] } = {
[MANTICORE_RANGE_FIRST]: [0, 1, 2],
[MANTICORE_MAGE_FIRST]: [1, 0, 2],
};
const MANTICORE_DELAY = 5;

const MINOTAUR = 5;
const MINOTAUR_HEAL_RANGE = 7;
Expand Down Expand Up @@ -661,6 +662,7 @@ export function step() {
? tickCount >= DELAY_FIRST_ATTACK_TICKS
: true;
var line: TapeEntry = [];
let mantiSameTick = false;
for (var i = 0; i < mobs.length; i++) {
if (mobs[i][2] < 8) {
var mob = mobs[i];
Expand Down Expand Up @@ -700,10 +702,18 @@ export function step() {
if (canAttack && hasLOS(x, y, selected[0], selected[1], s, r, true)) {
if (mob[5] <= 0) {
if (mob[2] === MANTICORE) {
manticoreTicksRemaining[i] = 3;
}
attacked = 1;
mob[5] = CD[t];
if (mantiSameTick) { // give delay when seen on same tick
mob[5] = MANTICORE_DELAY;
} else {
manticoreTicksRemaining[i] = 3;
attacked = 1;
mob[5] = CD[t];
}
mantiSameTick = true;
} else {
attacked = 1;
mob[5] = CD[t];
}
}
}
// pack the positions into 3rd and 4th byte (2nd byte is manticore attack style)
Expand Down

0 comments on commit 2516427

Please sign in to comment.