mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.4.07
This commit is contained in:
parent
beb2d0ad7c
commit
2d2432acb2
1 changed files with 8 additions and 6 deletions
|
|
@ -23,8 +23,9 @@ class Battle {
|
||||||
this.getInitialMorale();
|
this.getInitialMorale();
|
||||||
|
|
||||||
$("#battleScreen").dialog({
|
$("#battleScreen").dialog({
|
||||||
title: this.name, resizable: false, width: fitContent(), close: this.closeBattleScreen,
|
title: this.name, resizable: false, width: fitContent(),
|
||||||
position: {my: "center", at: "center", of: "#map"}
|
position: {my: "center", at: "center", of: "#map"},
|
||||||
|
close: () => Battle.prototype.context.cancelResults()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (modules.Battle) return;
|
if (modules.Battle) return;
|
||||||
|
|
@ -332,7 +333,8 @@ class Battle {
|
||||||
Military.moveRegiment(r, r.x + rand(30) - 15, r.y + rand(30) - 15);
|
Military.moveRegiment(r, r.x + rand(30) - 15, r.y + rand(30) - 15);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#battleScreen").dialog("close");
|
$("#battleScreen").dialog("destroy");
|
||||||
|
this.cleanData();
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelResults() {
|
cancelResults() {
|
||||||
|
|
@ -342,15 +344,15 @@ class Battle {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#battleScreen").dialog("close");
|
$("#battleScreen").dialog("close");
|
||||||
|
this.cleanData();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeBattleScreen() {
|
cleanData() {
|
||||||
battleAttackers.innerHTML = battleDefenders.innerHTML = ""; // clean DOM
|
battleAttackers.innerHTML = battleDefenders.innerHTML = ""; // clean DOM
|
||||||
customization = 0; // exit edit mode
|
customization = 0; // exit edit mode
|
||||||
|
|
||||||
// clean temp data
|
// clean temp data
|
||||||
const context = Battle.prototype.context;
|
this.attackers.regiments.concat(this.defenders.regiments).forEach(r => {
|
||||||
context.attackers.regiments.concat(context.defenders.regiments).forEach(r => {
|
|
||||||
delete r.px;
|
delete r.px;
|
||||||
delete r.py;
|
delete r.py;
|
||||||
delete r.casualties;
|
delete r.casualties;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue