Skip to content

Commit

Permalink
Sneak for all guards, unblock 179
Browse files Browse the repository at this point in the history
  • Loading branch information
oklemenz committed May 10, 2022
1 parent 17a578a commit 6c170a5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions assets/maps/custom/level178.json
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,7 @@
"skill": 0,
"colors": 2,
"type": "guard",
"direction": 1,
"sneak": true
"direction": 1
},
{
"room": 6,
Expand All @@ -1814,8 +1813,7 @@
"skill": 4,
"colors": 4,
"type": "guard",
"direction": 1,
"sneak": true
"direction": 1
},
{
"room": 13,
Expand Down
3 changes: 2 additions & 1 deletion assets/maps/custom/level179.json
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,8 @@
"skill": 4,
"colors": 6,
"type": "guard",
"direction": -1
"direction": -1,
"bias": 1
},
{
"room": 15,
Expand Down
3 changes: 1 addition & 2 deletions assets/maps/level8.json
Original file line number Diff line number Diff line change
Expand Up @@ -2733,8 +2733,7 @@
"skill": 3,
"colors": 4,
"type": "guard",
"direction": -1,
"sneak": true
"direction": -1
}
],
"events": [
Expand Down
6 changes: 3 additions & 3 deletions src/Enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PrinceJS.Enemy = function (game, level, location, direction, room, skill, color,
this.strikeTimer = 0;
this.lookBelow = false;
this.startFight = false;
this.sneakUp = false;
this.sneakUp = true;

this.health = PrinceJS.Enemy.EXTRA_STRENGTH[skill] + PrinceJS.Enemy.STRENGTH[this.level.number];

Expand Down Expand Up @@ -388,8 +388,8 @@ PrinceJS.Enemy.prototype.setInactive = function () {
}
};

PrinceJS.Enemy.prototype.setSneakUp = function () {
this.sneakUp = true;
PrinceJS.Enemy.prototype.setSneakUp = function (state) {
this.sneakUp = state;
};

PrinceJS.Enemy.prototype.checkBarrier = function () {
Expand Down
2 changes: 1 addition & 1 deletion src/Fighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ PrinceJS.Fighter.prototype.moveL = function (extended = true) {
};

PrinceJS.Fighter.prototype.sneaks = function () {
return ["stoop", "stand", "standup", "turn", "jumphanglong", "hang", "climbup", "climbdown"].includes(this.action) || this.action.startsWith("step");
return ["stoop", "stand", "standup", "turn", "jumphanglong", "hang", "hangdrop", "climbup", "climbdown", "testfoot"].includes(this.action) || this.action.startsWith("step");
};

PrinceJS.Fighter.prototype.getCharBounds = function () {
Expand Down
4 changes: 2 additions & 2 deletions src/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ PrinceJS.Game.prototype = {
if (data.active === false) {
enemy.setInactive();
}
if (data.sneak === true) {
enemy.setSneakUp();
if (data.sneak === false) {
enemy.setSneakUp(false);
}
enemy.onInitLife.add((fighter) => {
this.ui.setOpponentLive(fighter);
Expand Down

0 comments on commit 6c170a5

Please sign in to comment.