Esempio n. 1
0
    public override float Execute(UrbAgent Instigator, UrbAgent Target, float Modifier = 0)
    {
        if (Instigator.WasDestroyed || Target.WasDestroyed)
        {
            return(0);
        }

        using (s_AttackAction_p.Auto())
        {
            float Result = base.Execute(Instigator, Target, Modifier);

            if (!(Result > 0))
            {
                return(Result);
            }

            //Instigator.CurrentTile.AddScent(UrbScentTag.Violence, Result);

            UrbAction DefenseAction = Target.PickAction(DefenseCategory, Result);

            if (DefenseAction != null)
            {
                Result -= DefenseAction.Execute(Target, Instigator);
            }

            if (Result > 0)
            {
                Result = DamageAction.Execute(Instigator, Target, Result);
            }

            return(Result);
        }
    }
Esempio n. 2
0
    public virtual float GiveTo(UrbAgent Target, UrbSubstanceTag Substance)
    {
        if (!Target.HasBody)
        {
            return(0);
        }

        float Amount = 0;

        UrbAction HoldAction = mAgent.PickAction(UrbTestCategory.Hold);

        if (HoldAction != null)
        {
            Amount = HoldAction.Execute(mAgent, Target);
            if (Target.IsGrasper)
            {
                Target.Grasper.TakeFrom(mAgent, Substance);
            }
            else if (Target.IsEater)
            {
                Amount = HeldComposition.TransferTo(Target.Eater.Stomach, Substance, Amount);
            }
            else
            {
                Amount = HeldComposition.TransferTo(Target.mBody.BodyComposition, Substance, Amount);
            }
        }

        return(Amount);
    }