Skip to content

Commit

Permalink
Fix enemy update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-crane committed Mar 16, 2018
1 parent 382a679 commit 8c40596
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
This changelog uses [Semantic Versioning 2.0.0](https://semver.org/).

## `6.17.1`
### Fixes:
+ Fixed a bug where enemies would not receive new tick updates sometimes.
+ Fixed a typo in the `Projectile` class.

## `6.17.0`
> The changes in this version are part of features which are not fully complete yet and may still contain bugs.
> If you need a **stable** version of nrelay, do not upgrade to this version.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nrelay",
"version": "6.17.0",
"version": "6.17.1",
"description": "A console based modular client for Realm of the Mad God built with Node.js and TypeScript.",
"main": "index.js",
"bin": {
Expand Down
14 changes: 8 additions & 6 deletions src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class Client {
Log(this.alias, 'Preventing EnemyHit. Time since last update: ' + lastUpdate, LogLevel.Warning);
}
this.projectiles.splice(i, 1);
break;
continue;
}
const enemyHit = new EnemyHitPacket();
const damage = closestEnemy.damage(this.projectiles[i].damage);
Expand All @@ -465,7 +465,7 @@ export class Client {
if (enemyHit.kill) {
closestEnemy.dead = true;
}
break;
continue;
}
}
}
Expand Down Expand Up @@ -539,7 +539,9 @@ export class Client {
}
}
if (obj.enemy) {
this.enemies[updatePacket.newObjects[i].status.objectId] = new Enemy(obj);
if (!this.enemies[updatePacket.newObjects[i].status.objectId]) {
this.enemies[updatePacket.newObjects[i].status.objectId] = new Enemy(obj);
}
this.enemies[updatePacket.newObjects[i].status.objectId].update(updatePacket.newObjects[i].status);
}
}
Expand Down Expand Up @@ -663,10 +665,10 @@ export class Client {
this.playerData.objectId = this.objectId;
this.playerData.worldPos = this.worldPos;
this.playerData.server = this.server.name;
break;
continue;
}
if (this.enemies[newTickPacket.statuses[i].objectId]) {
this.enemies[newTickPacket.statuses[i].objectId].update(newTickPacket.statuses[i]);
if (this.enemies[status.objectId]) {
this.enemies[status.objectId].update(status);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/models/projectile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Projectile {
const angleX = Math.cos(this.startAngle);
const angleY = Math.sin(this.startAngle);
point.x += (offset2 * angleY - offset3 * angleX) * this.projectileProperties.magnitude;
point.x += (offset2 * angleX - offset3 * angleY) * this.projectileProperties.magnitude;
point.y += (offset2 * angleX - offset3 * angleY) * this.projectileProperties.magnitude;
} else {
if (this.projectileProperties.boomerang) {
const halfwayPoint = this.projectileProperties.lifetimeMS * (this.projectileProperties.speed / 10000) / 2;
Expand Down

0 comments on commit 8c40596

Please sign in to comment.