Skip to content

Commit

Permalink
more random loot, and no loot for most enemies
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <uso.cosmo.ray@gmail.com>
  • Loading branch information
cosmo-ray committed Dec 7, 2023
1 parent 9c70a06 commit 20bc022
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions npcs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"max_life": 13,
"is_generic": true,
"hair": ["plain", "raven"],
"loot": "auto",
"equipement": {
"torso": "white longsleeve m",
"legs": "teal pants m",
Expand Down
2 changes: 2 additions & 0 deletions npcs/random.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Thrug 0": {
"sex": "male",
"type": "light",
"loot": "auto",
"max_life": 10,
"clothes": [
"feet/shoes/male/brown_shoes_male.png",
Expand All @@ -51,6 +52,7 @@
"Thrug 1": {
"sex": "male",
"type": "light",
"loot": "auto",
"max_life": 10,
"clothes": [
"feet/shoes/male/brown_shoes_male.png",
Expand Down
1 change: 1 addition & 0 deletions npcs/students.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"student_year": 1,
"max_life": 10,
"hair": ["princess", "white-blonde2"],
"loot": "auto",
"stats": {
"charm": 9,
"strength": 5,
Expand Down
2 changes: 1 addition & 1 deletion tileset/Street0.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,4 +697,4 @@
"type":"map",
"version":"1.9",
"width":20
}
}
22 changes: 12 additions & 10 deletions victoryScreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,23 @@ local function victoryScreenAction(vs, eve)
return YEVE_NOTHANDLE
end

local function autoLoot(main, pj, txt)
local nb = yuiRand() % 15
local function autoLoot(main, pj, looser, txt)
local max_life = yeGetInt(looser.max_life) + 3

local nb = yuiRand() % (max_life / 2)
addObject(main, pj, "money", nb)
return txt .. math.floor(nb) .. ": " .. "money" .. "\n"
return txt .. math.floor(nb) .. "$\n"
end

function pushNewVictoryScreen(main, _unused, loosers)
local victoryScreen = Entity.new_array()
local txt = "tatatata ta ta ta tata\nloot:\n"
local txt = "tatatata ta ta ta tata\n"
local i = 0

while i < yeLen(loosers) do
local looser = loosers[i]
local loot = loosers.loot
local loot = looser.loot

print(loot)
if looser.victory_action then
print("cmp: ", looser.victory_action:to_string(), "increase_int",
looser.victory_action:to_string() == "increase_int")
Expand All @@ -65,12 +66,15 @@ function pushNewVictoryScreen(main, _unused, loosers)
if loot then
if yeType(loot) == YSTRING then
if loot:to_string() == "auto" then
txt = autoLoot(main, phq.pj, txt)
txt = txt .. "loot:\n"
txt = autoLoot(main, phq.pj, looser, txt)
elseif loot:to_string() ~= "none" then
txt = txt .. "1: " .. loot:to_string() .. "\n"
addObject(main, phq.pj, loot:to_string(), 1)
end
elseif yeType(loot) == YARRAY then
txt = txt .. "loot:\n"

local j = 0
while j < yeLen(loot) do
if yeGetKeyAt(loot, j) then
Expand All @@ -81,7 +85,7 @@ function pushNewVictoryScreen(main, _unused, loosers)
yeGetIntAt(loot, j))
else
if yeGetStringAt(loot, j) == "auto" then
txt = autoLoot(main, phq.pj, txt)
txt = autoLoot(main, phq.pj, looser, txt)
else
txt = txt .. "1: " .. yeGetStringAt(loot, j) .. "\n"
addObject(main, phq.phq, yeGetStringAt(loot, j), 1)
Expand All @@ -90,8 +94,6 @@ function pushNewVictoryScreen(main, _unused, loosers)
j = j + 1
end
end
else
txt = autoLoot(main, phq.pj, txt)
end
i = i + 1
end
Expand Down

0 comments on commit 20bc022

Please sign in to comment.