mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 13:10:28 -04:00
Prevent duplicate names when creating enemies.
This commit is contained in:
parent
a58af71e19
commit
b1a83fbdca
1 changed files with 6 additions and 1 deletions
7
Input.js
7
Input.js
|
@ -1737,11 +1737,16 @@ function doAddEnemy(command) {
|
|||
if (spell != null) spells.push(spell)
|
||||
} while (spell != null)
|
||||
|
||||
for (var i = state.enemies.length - 1; i >= 0; i--) {
|
||||
var enemy = state.enemies[i]
|
||||
if (enemy.name.toLowerCase() == name.toLowerCase()) state.enemies.splice(i, 1)
|
||||
}
|
||||
|
||||
var enemy = createEnemy(name, health, ac, damage, initiative)
|
||||
enemy.spells = spells
|
||||
state.enemies.push(enemy)
|
||||
|
||||
return `[Enemy ${enemy.name} has been created]`
|
||||
return `[Enemy ${toTitleCase(enemy.name)} has been created]`
|
||||
}
|
||||
|
||||
function doInitiative(command) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue