diff --git a/modules/mobs_drop_loot.lua b/modules/mobs_drop_loot.lua index 5fa75e87..5bb7815d 100644 --- a/modules/mobs_drop_loot.lua +++ b/modules/mobs_drop_loot.lua @@ -236,8 +236,8 @@ local function roll_item_stack(entity, wave) local item_count = 1 for c = 1, random(1, stack_size), 1 do - local price = c * item_worth - if price <= wave then + local p = c * item_worth + if p <= wave then item_count = c else break @@ -249,27 +249,9 @@ local function roll_item_stack(entity, wave) return {name = item_name, count = item_count} end +-- local Public = require 'modules.mobs_drop_loot' Public.drop_loot(game.get_player('Gerkiz'), 80) function Public.drop_loot(entity, wave) - local returned_loot - if wave >= 1 and wave < 50 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 50 and wave < 100 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 100 and wave < 200 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 100 and wave < 400 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 400 and wave < 800 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 800 and wave < 1200 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 1200 and wave < 2000 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 2000 and wave < 3000 then - returned_loot = roll_item_stack(entity, wave) - elseif wave >= 3000 and wave < 4000 then - returned_loot = roll_item_stack(entity, wave) - end + local returned_loot = roll_item_stack(entity, wave) return returned_loot end diff --git a/modules/rpg/main.lua b/modules/rpg/main.lua index a36c9f90..1ab4660c 100644 --- a/modules/rpg/main.lua +++ b/modules/rpg/main.lua @@ -536,11 +536,10 @@ local function on_entity_damaged(event) end end ) - -- if success then - log(serpent.block('hit')) - Public.aoe_punch(cause, entity, damage, get_health_pool) -- only kill the biters if their health is below or equal to zero - return - -- end + if success then + Public.aoe_punch(cause, entity, damage, get_health_pool) -- only kill the biters if their health is below or equal to zero + return + end end end diff --git a/modules/rpg/spells.lua b/modules/rpg/spells.lua index 1a4c1413..472a840c 100644 --- a/modules/rpg/spells.lua +++ b/modules/rpg/spells.lua @@ -68,7 +68,7 @@ local function area_of_effect(player, position, state, radius, callback, find_en if d < radius then local p = {x = x, y = y} if find_entities then - for _, e in pairs(cs.find_entities_filtered({position = p})) do + for _, e in pairs(cs.find_entities({{p.x - 1, p.y - 1}, {p.x + 1, p.y + 1}})) do if e and e.valid and e.name ~= 'character' and e.health and e.destructible and e.type ~= 'simple-entity' and e.type ~= 'simple-entity-with-owner' then callback(e, p) end @@ -140,10 +140,10 @@ local function create_projectiles(data) right_bottom = {x = position.x + 2, y = position.y + 2} } do_projectile(surface, self.entityName, position, force, target_pos, range) + Public.remove_mana(player, self.mana_cost) if self.damage then for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do damage_entity(e) - Public.remove_mana(player, self.mana_cost) end end end @@ -153,11 +153,11 @@ local function create_projectiles(data) right_bottom = {x = position.x + 2, y = position.y + 2} } do_projectile(surface, self.entityName, position, force, target_pos, range) + Public.remove_mana(player, self.mana_cost) if self.damage then for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do damage_entity(e) - Public.remove_mana(player, self.mana_cost) end end end @@ -946,6 +946,7 @@ spells[#spells + 1] = { log_spell = true, sprite = 'virtual-signal/signal-info', special_sprite = 'virtual-signal=signal-info', + tooltip = 'Damages enemies in radius when cast.', callback = function(data) local self = data.self local player = data.player @@ -980,7 +981,6 @@ spells[#spells + 1] = { end else if entity.valid then - log(serpent.block(entity.name)) entity.health = entity.health - damage if entity.health <= 0 then entity.die(entity.force.name, player.character)