mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-01 07:21:15 +00:00
Add "revive" modal on death
This commit is contained in:
parent
acabb18074
commit
b974d98f36
2 changed files with 22 additions and 5 deletions
|
|
@ -240,11 +240,7 @@ ready (model) ->
|
|||
if stats.hp?
|
||||
# game over
|
||||
if stats.hp < 0
|
||||
user.set 'stats', {hp: 50, lvl: 1, exp: 0, money: 0}
|
||||
user.set 'items.armor', 0
|
||||
user.set 'items.weapon', 0
|
||||
model.set '_items.armor', content.items.armor[1]
|
||||
model.set '_items.weapon', content.items.weapon[1]
|
||||
user.set 'stats.lvl', 0 # this signifies dead
|
||||
else
|
||||
user.set 'stats.hp', stats.hp
|
||||
|
||||
|
|
@ -403,6 +399,14 @@ ready (model) ->
|
|||
exports.toggleDebug = ->
|
||||
model.set('_debug', !model.get('_debug'))
|
||||
|
||||
exports.revive = (e, el) ->
|
||||
stats = model.at '_user.stats'
|
||||
stats.set 'hp', 50; stats.set 'lvl', 1; stats.set 'exp', 0; stats.set 'money', 0
|
||||
model.set '_user.items.armor', 0
|
||||
model.set '_user.items.weapon', 0
|
||||
model.set '_items.armor', content.items.armor[1]
|
||||
model.set '_items.weapon', content.items.weapon[1]
|
||||
|
||||
## SHORTCUTS ##
|
||||
|
||||
exports.shortcuts = (e) ->
|
||||
|
|
|
|||
|
|
@ -50,6 +50,19 @@
|
|||
<Body:>
|
||||
<br/>
|
||||
|
||||
<div style="{#unless equal(_user.stats.lvl,0)}display:none;{/}">
|
||||
<div data-action="backdrop" class="modal-backdrop"></div>
|
||||
<div class="modal" id="dead-modal">
|
||||
<div class="modal-header">
|
||||
<h3>Game Over</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>You're Dead.</p>
|
||||
<p><a x-bind=click:revive class="btn btn-danger">Revive</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
{#if _debug}
|
||||
<div class="alert">
|
||||
|
|
|
|||
Loading…
Reference in a new issue