1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00

Merge pull request #254 from ComfyFactory/rpg

rpg - fix issues
This commit is contained in:
Gerkiz 2022-04-21 21:59:10 +02:00 committed by GitHub
commit 71f81efdb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 31 deletions

View File

@ -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

View File

@ -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

View File

@ -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)