P3 thieves and barrow: crows and foxes steal food left out; the barrow with its guards, coffin loot and key pieces; blunt club vs bone (protocol 10)
This commit is contained in:
@@ -305,6 +305,24 @@ func toggle_door(player: Node3D, door: Node3D) -> bool:
|
||||
door.set_open(not door.open)
|
||||
return true
|
||||
|
||||
## E on the barrow's coffin (barrow.gd): take what's in it. Opening it wakes
|
||||
## the guards. What doesn't fit goes on the floor by you.
|
||||
func loot_barrow(player: Node3D, barrow: Node) -> bool:
|
||||
if barrow == null or not barrow.found or not _in_reach(player, barrow._coffin, 0.5):
|
||||
return false
|
||||
if _online():
|
||||
return _ask("barrow_loot", [])
|
||||
var got: Dictionary = barrow.loot(player)
|
||||
if got.is_empty():
|
||||
return false
|
||||
for id in got:
|
||||
var left: int = player.inventory.add(id, int(got[id]))
|
||||
if left > 0:
|
||||
barrow.world.drop_item(id, left, Transform3D(Basis(), player.global_position + Vector3(0, 0.3, 0)))
|
||||
item_gained.emit(id, int(got[id]))
|
||||
tell(player, "+%d %s" % [int(got[id]), ItemDB.item_name(id)])
|
||||
return true
|
||||
|
||||
## E on a door an alpha broke: mend it (two wood), shut.
|
||||
func repair_door(player: Node3D, door: Node3D) -> bool:
|
||||
if not is_instance_valid(door) or not door.get("broken") or not _in_reach(player, door, 1.0):
|
||||
@@ -359,7 +377,8 @@ func melee_stats(player: Node) -> Dictionary:
|
||||
var w: Dictionary = held.get("weapon", {})
|
||||
if float(w.get("damage", 0)) > 0.0:
|
||||
return {"damage": float(w.damage), "reach": float(w.get("reach", 2.2)),
|
||||
"stamina": float(w.get("stamina", 8)), "cooldown": float(w.get("cooldown", 0.5)), "armed": true}
|
||||
"stamina": float(w.get("stamina", 8)), "cooldown": float(w.get("cooldown", 0.5)), "armed": true,
|
||||
"blunt": bool(w.get("blunt", false))}
|
||||
if held.has("tool"):
|
||||
return {"damage": TOOL_AS_WEAPON, "reach": 2.3, "stamina": 6.0, "cooldown": 0.5, "armed": true}
|
||||
return NO_WEAPON
|
||||
@@ -384,7 +403,9 @@ func melee(player: Node3D, target: Node3D) -> bool:
|
||||
if not player.survival.use_stamina(m.stamina):
|
||||
notify.emit("Too tired")
|
||||
return false
|
||||
target.take_hit(m.damage, player.global_position)
|
||||
# Blunt weapons (the club) crack bone: +50% on skeletons.
|
||||
var bone := bool(target.def.get("bone", false)) if target.get("def") != null else false
|
||||
target.take_hit(m.damage * (1.5 if bone and m.get("blunt", false) else 1.0), player.global_position)
|
||||
use_held(player)
|
||||
if target.is_dead():
|
||||
notify.emit("Killed a %s" % target.display_name().to_lower())
|
||||
|
||||
Reference in New Issue
Block a user