World.testMap() sets World.seenAll. The latter is true when the whole map has been explored.
World.testMap() is called:
* on world init
* on return home (when the map is updated)
* on applyMap() (when the map is bought from the scout)
Limited subset of commits:
* unified function for healing (Events.doHeal);
* unified function for attacks (Events.damage);
* check if health is max, and disable healing buttons (Events.setHeal and related calls)
* grouping buttons (attackButtons, healButtons and exitButtons for weapon attacks, meat & meds, continue/leave)
As some of them are related to each other, this commit involves a lot of updates.
* Autopause on blur. This is an idea I took from Gridland (!), if window loses focus the fight pauses (timed check courtesy of the enemy), and it restarts when the window has focus again (if the pause button is clicked, then the player must click again in order to resume).
* Delayed start for fights. This will allow players to read the description without the player attacking them. No way to cheat, buttons are not enabled. I used Events._LEAVE_COOLDOWN as cooldown time, not for laziness, but because I guess the two durations have the same purpose: to allow (force) the player to read stuff.
* Take everything and leave just by name. If the player can just take something, the text is "take all you can", if they can take everything but there are several options it's "take everything", if the option is only one the text is "take everything and X", where X is the verb of the only possible option (note: in the latter case, the button cools down together with the option itself).
* success/failure mechanics no longer relies upon try/catch, but on a simple mechanism: a variable taking a bool value, set to true when one of the end conditions happens. The precedence goes to the enemy (if the player kills and dies the fight is lost).
Events.setHeal() enables/disables eatMeat and useMeds buttons depending on player's HP.
The check is done in 4 cases:
* when a fight starts
* after an attack
* after healing
* in the loot screen
Events.damage method now groups all common lines for Events.animateRanged and Events.animateMelee.
Balance between success and failure is now determined by Events.lost. It is set to "true" when the player is killed and prevents Events.winFight() altogether.
Events.endFight() groups the 2 consistent actions in winFight and loseFight, i.e., pause unsetting and stopping the enemy.
Completely renewed trap method: instead of relying on a separate counter, enemy.data('stunned') now returns the number of remaining seconds of stunning. Enemy's timed attack decreases this value by the attack delay time (the enemy fights for its freedom).
This commit adds a pause button during the fight. It relies upon the new
Events.paused property: when set to true, no buttons will work except
the pause button itself, and cooldown on attack/healing buttons is
interrupted.
This commit also groups event buttons in different groups (attack,
healing, scene), so that the position of "eat meat" and "use meds" does
not depend on how many scene buttons are present (sometimes 1, other
times 2)
For code consistency: in updateSupplies, num is forced to never be greater than have, so the "greater or equal" comparison is pointless
Increase buttons reactivate when total store quantity is greater than supplies.
Also, removed useless nesting of Math.min.
Unlike other stuff, stores in the side box never disappear during the game when they reach 0, once they've been "seen" (i.e., once State stores[store] has been set). But on reload they appear only if the quantity is positive.
For the sake of consistency, now null stores are visible on load (see what you're missing, bro).
The change is somehow linguistic, rather than anything else.
"Take everything and leave" changes name and becomes "Take everything and X", where X is the verb of the command it impersonates.
This way after completing mines e.g. it is "Take everything and continue", acting like "continue" button.
It now also cools down if it impersonates a "leave" button (leave buttons cool down. IDK why).
Maps cost! Let's apply them where necessary.
World.testMap() checks if there's still something to explore.
World.seenAll is true when everything has been seen. It is updated by uncoverMap().
World.applyMap() chooses a random center, with the conditions that
1. there's still something to explore
1. the center itself is an undiscovered area.
Buy Map is active only when a map is still useful.
Maps cost! And casual gamers could possibly forget whether they've explored everything.
The Buy map button is now disabled if the whole map has been seen (yes, even a single uncovered tile is enough).
Supplies are not removed from state when embarking, so they remain in place in case the game is closed during exploration. So it now happens in case of death, along with Path.outfit reset.
It seems counterintuitive for players that, if the game is closed while exploring, everything remains unchanged but supplies are lost. I had to choose between cooling down Embark, thus making it explicit that it's as if the player had died, or leave supplies in place. I chose the latter.
A very easy fix indeed. When Path is active, the outfit is updated on Income event. This way the "available" tooltip is reliable, increment/decrement buttons are activated/deactivated correctly and there is no risk of phantom resources.
Kept the distinction between "argument" time and script time. I called the latter "time" instead of "milliseconds" because, well, it's just tenth of seconds.
Residual timeout is always stored in "nominal" time, not adjusted by hyper. I.e. if a button has a nominal timeout of 60 seconds and half cooldown had expired on reload, residual is stored as 300. In cooldown, Engine.setInterval makes the time flow with double speed
This commit carries some changes.
* the compass is now a "special" item, not "good". It allows a different placing
* Store block is now divided into 2 parts. All the script is adapted to make room for it, including empty block check and insert animation for the new #store children divs
** Above: stackable storable items (resources), whose tooltip shows updated income/consumption rates
** Below: special storable items. As of now, it only contains the compass. Special block has a special style, with some distance from resources block if that one exists.
* Compass row has an empty tooltip which is filled in by World
Instead of a timed method to restore lx/rx navigation, a property will be set to true. In that case, the keyup method will not be executed, but it will restore navigation for further use.
R wild animals (beast, birds, lizards, rats)
T mutated creatures (includes giant lizards)
E human enemies (old men, scavengers, thugs and squatters)
D armed human enemies (includes vigilantes, soldiers, snipers, commandos, veterans and chiefs)
Added Engine.tabNavigation property. When true, it enables keyboard navigation to/from tabs. It is disabled on world and enabled some milliseconds after Path.onArrival(), so that when player returns s/he finds him/herself on Path tab instead of navigating.
Export dialog replaces selection dialog, rather than overlapping it.
Closing it exits the panel and returns to current game.
Aborting Import dialog returns the player to the selection screen, so that s/he can save before trying to load.