public ActionResult DescribeInventory() { var result = new ActionResult(); result.AppendMessage(new Message("Your bag holds...", null)); foreach (var item in _inventory.heldItems) { result.AppendMessage(new Message(item.ToString(), null)); } result.Success = false; return(result); }
public ActionResult AddItem(Item item) { var result = new ActionResult(); heldItems.Add(item); result.AppendMessage(new Message($"{item.owner.GetColoredName()} added to {owner.GetColoredName()}'s inventory.", null)); return(result); }
private WaitAction BuildWaitAction(ActionResult actionResult, EntityMap entityMap, GroundMap groundMap, bool logMessage = true) { if (logMessage) { actionResult.AppendMessage(new Message($"The {owner.name} is confused. What should it do?", null)); } var action = new WaitAction(owner.actor); actionResult.Success = true; action.SetActionResult(actionResult); return(action); }
public ActionResult ConvertToDeadPlayer() { var actionResult = new ActionResult(); sprite = SpriteLoader.instance.LoadSprite(SpriteType.Remains_Bones); color = new Color(.8f, .8f, .8f, 1); spriteRenderer.sprite = sprite; spriteRenderer.color = color; actionResult.AppendMessage(new Message("You died!", Color.red)); return(actionResult); }
public ActionResult Attack(Entity target) { var actionResult = new ActionResult(); var fighterComponent = target?.gameObject.GetComponent <Fighter>(); if (fighterComponent == null) { return(actionResult); } var damage = offensePower - fighterComponent.defensePower; if (damage > 0) { actionResult.AppendMessage(new Message($"{owner.GetColoredName()} attacks {target.GetColoredName()} for {damage} hit points!", null)); actionResult.Append(fighterComponent.TakeDamage(damage)); } else { actionResult.AppendMessage(new Message($"{owner.GetColoredName()} attacks {target.GetColoredName()} for no damage.", null)); } return(actionResult); }
public ActionResult ConvertToDeadMonster() { var actionResult = new ActionResult(); sprite = SpriteLoader.instance.LoadSprite(SpriteType.Remains_Skull); actionResult.AppendMessage(new Message($"{GetColoredName()} is dead!", null)); color = new Color(.8f, .8f, .8f, 1); spriteRenderer.sprite = sprite; spriteRenderer.color = color; name = $"remains of {name.ToPronoun()}"; blocks = false; // Probably a better way to do this // Common method on EntityComponent? Destroy(gameObject.GetComponent <Fighter>()); Destroy(gameObject.GetComponent <BasicMonsterAi>()); return(actionResult); }