-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
REPAIR_DRONE_HEAL = 2 | ||
|
||
register_enemy("REPAIR_DRONE", { | ||
name = "Repair Drone", | ||
description = "A drone designed to repair and support other machines.", | ||
look = [[]rr[]], | ||
color = "#00ff00", | ||
initial_hp = 10, | ||
max_hp = 10, | ||
gold = 50, | ||
intend = function(ctx) | ||
local opponents = get_opponent_guids(PLAYER_ID) | ||
|
||
-- Check if any opponent needs healing | ||
for _, opponent_guid in ipairs(opponents) do | ||
local opponent = get_actor(opponent_guid) | ||
if opponent_guid ~= ctx.guid and opponent.hp < opponent.max_hp then | ||
return "Heal " .. highlight(REPAIR_DRONE_HEAL) .. " HP to an ally" | ||
end | ||
end | ||
|
||
return "Standby..." | ||
end, | ||
callbacks = { | ||
on_turn = function(ctx) | ||
local opponents = get_opponent_guids(PLAYER_ID) | ||
|
||
-- Check if any opponent needs healing | ||
for _, opponent_guid in ipairs(opponents) do | ||
local opponent = get_actor(opponent_guid) | ||
if opponent_guid ~= ctx.guid and opponent.hp < opponent.max_hp then | ||
heal(ctx.guid, opponent_guid, REPAIR_DRONE_HEAL) | ||
return nil | ||
end | ||
end | ||
|
||
return nil | ||
end | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters