public override void Take(Entity taker) { if (item.ontake) { InventoryItem newitem = new InventoryItem(item); newitem.Use(taker, true); if (taker == Program.entities[0]) Program.Report(String.Concat("Hit by ", newitem.name, "!")); this.Got(); } else { if (taker.Get(item)) this.Got(); } }
public override bool Bump(Entity bumper) { if (item.onbump) { InventoryItem newitem = new InventoryItem(item); string oldname = bumper.name; newitem.Use(bumper, true); if (bumper == Program.entities[0]) Program.Report(String.Concat("Hit by ", newitem.name, "!")); else Program.Report(String.Concat(oldname, " was hit by ", newitem.name, "!")); this.Got(); if (!this.item.remain) return true; else return false; } else { if (bumper == Program.entities[0]) Program.Report(description); return false; } }
public bool Get(Item newItem) { InventoryItem item = new InventoryItem(newItem); if (inventory.Count == 10) { if (this == Program.entities[0]) Program.Report(String.Concat("Can't get ", item.name, "- Inventory is full!")); return false; } else { inventory.Add(item); if (this == Program.entities[0]) Program.Report(String.Concat("Got ", item.name)); return true; } }
private bool CanEquip(InventoryItem item) { bool result = true; foreach (InventoryItem u in this.inventory.Where(u => u.equipped)) if (u.item.equipslot == item.item.equipslot) { result = false; break; } return result; }
public void Equip(InventoryItem item) { if (this.inventory.Contains(item) && (((this.CanEquip(item)) && (item.equipped == false)) || (item.equipped == true)) && (item.equippable == true) && (!this.species.cantequip)) { item.Equip(this); } else if (this == Program.entities[0]) Program.Report(String.Concat("Can't equip ", item.name, " right now!")); }