Skip to content

Commit

Permalink
v.1.2.6 - work with Halite 1.1.6 for spawn-collision
Browse files Browse the repository at this point in the history
  • Loading branch information
fohristiwhirl committed Dec 10, 2018
1 parent 0428c47 commit 6ca9ea0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions fluorine_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,18 +483,21 @@ function make_renderer() {

let burned_en_route = 0;

if (final_state.x !== data.x || final_state.y !== data.y) { // The ship moved before colliding.
let ground = renderer.production_list[n][final_state.x][final_state.y]; // Ship's source before moving.
if (final_state.is_inspired) {
burned_en_route = Math.floor(ground / renderer.game.GAME_CONSTANTS.INSPIRED_MOVE_COST_RATIO);
} else {
burned_en_route = Math.floor(ground / renderer.game.GAME_CONSTANTS.MOVE_COST_RATIO);
if (final_state !== undefined) { // If undefined, it's a ship that crashed as it was created. Applies to Halite 1.1.6 onwards.

if (final_state.x !== data.x || final_state.y !== data.y) { // The ship moved before colliding.
let ground = renderer.production_list[n][final_state.x][final_state.y]; // Ship's source before moving.
if (final_state.is_inspired) {
burned_en_route = Math.floor(ground / renderer.game.GAME_CONSTANTS.INSPIRED_MOVE_COST_RATIO);
} else {
burned_en_route = Math.floor(ground / renderer.game.GAME_CONSTANTS.MOVE_COST_RATIO);
}
}
}

data.halite_losses[pid] += final_state.energy - burned_en_route;
data.halite_losses[pid] += final_state.energy - burned_en_route;

total_dropped += final_state.energy - burned_en_route;
total_dropped += final_state.energy - burned_en_route;
}
}

// Adjustment for collisions over a factory...
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Fluorine",
"description": "Replay viewer for Halite 3",
"version": "1.2.5",
"version": "1.2.6",
"author": "Fohristiwhirl",
"repository": {
"type": "git",
Expand Down

0 comments on commit 6ca9ea0

Please sign in to comment.