示例#1
0
    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);
    }
示例#2
0
    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);
    }
示例#3
0
    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);
    }
示例#4
0
    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);
    }
示例#5
0
    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);
    }
示例#6
0
    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);
    }