diff --git a/OutlawEditor/src/main/resources/mythos/mythos-editor/html/editor.html b/OutlawEditor/src/main/resources/mythos/mythos-editor/html/editor.html
index 81b6a837..69497e7d 100644
--- a/OutlawEditor/src/main/resources/mythos/mythos-editor/html/editor.html
+++ b/OutlawEditor/src/main/resources/mythos/mythos-editor/html/editor.html
@@ -140,8 +140,6 @@
-
-
diff --git a/OutlawEditor/src/main/resources/mythos/mythos-editor/js/mythos_uncompressed.js b/OutlawEditor/src/main/resources/mythos/mythos-editor/js/mythos_uncompressed.js
index 23f4405f..6684323c 100644
--- a/OutlawEditor/src/main/resources/mythos/mythos-editor/js/mythos_uncompressed.js
+++ b/OutlawEditor/src/main/resources/mythos/mythos-editor/js/mythos_uncompressed.js
@@ -814,36 +814,7 @@ if (typeof Mythos === "undefined") {
.appendField(new Blockly.FieldTextInput(""), "NAME")
.appendField("stat");
this.setOutput(true, "Number");
- this.setTooltip('Get player stat');
- }
- };
- Blockly.Blocks['interaction_set_stat'] = {
- init: function () {
- this.setHelpUrl(Mythos.helpUrl);
- this.setColour(54);
- this.setPreviousStatement(true);
- this.setNextStatement(true);
- this.appendDummyInput()
- .appendField("Set player's")
- .appendField(new Blockly.FieldTextInput(""), "NAME")
- .appendField("stat to")
- .appendField(new Blockly.FieldTextInput("0"), "NUMBER");
- this.setOutput(false);
- this.setTooltip('Set a player stat');
- }
- };
- Blockly.Blocks['interaction_set_stat_expr'] = {
- init: function () {
- this.setHelpUrl(Mythos.helpUrl);
- this.setColour(54);
- this.setPreviousStatement(true);
- this.setNextStatement(true);
- this.appendValueInput("EXPR")
- .appendField("Set player's")
- .appendField(new Blockly.FieldTextInput(""), "NAME")
- .appendField("stat to");
- this.setOutput(false);
- this.setTooltip('Set a player stat by variable amount');
+ this.setTooltip('Get best player stat in context');
}
};
Blockly.Blocks['interaction_increase_stat'] = {
diff --git a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy
index 2d842532..d7e98e7a 100644
--- a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy
+++ b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy
@@ -2937,7 +2937,7 @@ class A2PackPartitions
{
mapName = mapName.trim().replaceAll(/\s*-\s*[23][dD]\s*/, "")
script.block.'**'.each { blk ->
- if (blk?.@type =~ /^interaction_(increase|decrease|set|get)_stat.*/) {
+ if (blk?.@type =~ /^interaction_(increase|decrease|get)(_party)?_stat.*/) {
def statName = blk.field[0].text().trim().toLowerCase()
def getOrSet = blk.@type == "interaction_get_stat" ? "Checked" : "Set"
if (!statUses.containsKey(statName))
@@ -5102,8 +5102,6 @@ end
case 'interaction_increase_stat_expr':
case 'interaction_decrease_stat':
case 'interaction_decrease_stat_expr':
- case 'interaction_set_stat':
- case 'interaction_set_stat_expr':
packChangeStat(blk); break
case 'interaction_increase_party_stats':
case 'interaction_decrease_party_stats':
@@ -5430,15 +5428,7 @@ end
def amount = blk.field[1].text().toInteger()
assert amount > 0 && amount < 32767
def stat = nameToStat(name)
- variables << "p_player"
- outIndented("p_player = global=>p_players\n")
- outIndented("while p_player\n")
- ++indent
- outIndented("setStat(p_player, $stat, getStat(p_player, $stat) " +
- "${blk.@type == 'interaction_increase_party_stats' ? '+' : '-'} $amount)\n")
- outIndented("p_player = p_player=>p_nextObj\n")
- --indent
- outIndented("loop\n")
+ outIndented("adjustPartyStat($stat, ${blk.@type == 'interaction_increase_party_stats' ? '+' : '-'}$amount)\n")
}
def packPause(blk)
@@ -5494,7 +5484,7 @@ end
{
def name = getSingle(blk.field, 'NAME').text()
def stat = nameToStat(name)
- out << "getStat(global=>p_players, $stat)"
+ out << "getStatInContext($stat)"
}
def packGetFlag(blk)
diff --git a/Platform/Apple/virtual/src/plasma/gamelib.plh b/Platform/Apple/virtual/src/plasma/gamelib.plh
index f80db29c..675600f0 100644
--- a/Platform/Apple/virtual/src/plasma/gamelib.plh
+++ b/Platform/Apple/virtual/src/plasma/gamelib.plh
@@ -65,6 +65,7 @@ import gamelib
predef getPos(px, py)#0
predef getScreenLine(n)#1
predef getStat(player, statName)#1
+ predef getStatInContext(statName)#1
predef getStringResponse()#1
predef getUpperKey()#1
predef getYN()#1
@@ -182,6 +183,8 @@ import gamelib
byte needRender
byte diskLimit
byte curHeapPct
+ word playerUsing
+
/////////// Shared string constants //////////////
diff --git a/Platform/Apple/virtual/src/plasma/gameloop.pla b/Platform/Apple/virtual/src/plasma/gameloop.pla
index 3db6c13a..7a6ca180 100644
--- a/Platform/Apple/virtual/src/plasma/gameloop.pla
+++ b/Platform/Apple/virtual/src/plasma/gameloop.pla
@@ -206,6 +206,8 @@ word recordSeed
export byte diskLimit = 0
+export word playerUsing = NULL
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// Definitions used by assembly code
asm _defs
@@ -2864,6 +2866,7 @@ def showPlayerSheet(num)#1
setTextCountdown
fin
fin
+ playerUsing = NULL
return 0
end
@@ -3585,14 +3588,16 @@ export def adjustPartyStat(statName, val)#0
end
///////////////////////////////////////////////////////////////////////////////////////////////////
-// Get the max value of the stat for any (living) character in the party
-export def getPartyStat(statName)#1
+// Get the max value of the stat for any (living) character in the party.
+// Except if a particular player is using a skill or item in which case it's their stat only.
+export def getStatInContext(statName)#1
word p_player, val
val = 0
when 1
is streqi(statName, @S_GOLD); return global=>w_gold
is streqi(statName, @S_TIME); return global->b_hour
is streqi(statName, @S_BANK_BAL); return global=>w_bankBal
+ is playerUsing <> NULL; return getStat(playerUsing, statName)
otherwise
p_player = global=>p_players
while p_player
diff --git a/Platform/Apple/virtual/src/plasma/party.pla b/Platform/Apple/virtual/src/plasma/party.pla
index 0c25e2ab..d89183e7 100644
--- a/Platform/Apple/virtual/src/plasma/party.pla
+++ b/Platform/Apple/virtual/src/plasma/party.pla
@@ -344,6 +344,7 @@ def doUseSkill(player)#1
rawDisplayf1("\nUse which skill/attr? [A-%c] or [Esc]", nSkills-1+'A')
sel = getUpperKey()
if sel >= 'A' and (sel-'A') < nSkills
+ playerUsing = player
return skillName[sel-'A']
elsif sel == $1B // esc
break
@@ -390,10 +391,13 @@ def showSkillsMenu(player)#0
byte playerCount
playerCount = countList(global=>p_players)
clearMenuRect()
- if player->b_skillPoints > 0
- rawDisplayf2("Assign point [A-%c], Undo pt [Ctrl-A - Ctrl-%c], ", nSkills-1+'A', nSkills-1+'A')
+ if player=>w_health > 0
+ if player->b_skillPoints > 0
+ rawDisplayf2("Assign point [A-%c], Undo pt [Ctrl-A - Ctrl-%c], ", nSkills-1+'A', nSkills-1+'A')
+ fin
+ rawDisplayStr("\nU)se skill/attr, ")
fin
- rawDisplayStr("\nU)se skill/attr, X:Inventory, ")
+ rawDisplayStr("X:Inventory, ")
if playerCount > 1; rawDisplayf1("Player [1-%d], ", playerCount); fin
rawDisplayStr("[Esc]")
end
@@ -631,6 +635,7 @@ def doUseItem(player, item)#1
// General 'use' handled by outer engine, because it might involve graphics.
// Depluralize the name on the way out, because scripts will match on that.
isPlural = FALSE
+ playerUsing = player
return mmgr(HEAP_INTERN, sprintf1("%s", item=>s_name))
end
@@ -885,14 +890,14 @@ def doPlayerSheet(player_num)#1
beep
fin
else // mode == 'S'
- if sel == 'U'
+ if sel == 'U' and player=>w_health > 0
item = doUseSkill(player)
if item; return item; fin // Use a skill
else
noRepeatMenu = TRUE
- if sel >= 'A' and (sel-'A' < nSkills)
+ if sel >= 'A' and (sel-'A' < nSkills) and player=>w_health > 0
adjustSkill(player, sel - 'A', 1)
- elsif sel >= 1 and (sel-1 < nSkills)
+ elsif sel >= 1 and (sel-1 < nSkills) and player=>w_health > 0
adjustSkill(player, sel - 1, -1)
else
beep