예제 #1
0
    public override int Resolve()
    {
        // Set a random target if none exists.
        if (this.target == null)
        {
            int range = argumentOwner.GetTargetableArguments().Count + 1;
            int index = UnityEngine.Random.Range(0, range);
            if (index == 0)
            {
                this.target = argumentOwner.GetCoreArgument();
            }
            else
            {
                this.target = argumentOwner.GetTargetableArguments()[index - 1];
            }
        }
        int damageDealt = CalculateDamage(UnityEngine.Random.Range(damageMin, damageMax + 1));

        // Handle Poise removal.
        if (this.target.poise > 0 && !piercingDamage)
        {
            if ((damageDealt - this.target.poise) > 0)
            {
                damageDealt      -= this.target.poise;
                this.target.poise = 0;
            }
            else
            {
                this.target.poise -= damageDealt;
                EventSystemManager.Instance.TriggerEvent(new EventArgAttackedBlocked(target, damageDealt));
                return(damageDealt);
            }
        }


        this.target.curHP -= damageDealt;
        EventSystemManager.Instance.TriggerEvent(new EventArgAttackedUnblocked(target, damageDealt));


        // Check to see if the target argument should be destroyed.
        if (this.target.curHP <= 0)
        {
            if (attackingCard != null)
            {
                NegotiationManager.Instance.AddAction(new DestroyArgumentAction(target, attackingCard));
            }
            else if (attackingArgument != null)
            {
                NegotiationManager.Instance.AddAction(new DestroyArgumentAction(target, attackingArgument));
            }
            else
            {
                NegotiationManager.Instance.AddAction(new DestroyArgumentAction(target));
            }
        }
        return(0);
    }
예제 #2
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        if (target.isCore || target.OWNER != this.OWNER)
        {
            throw new Exception("You must target friendly support arguments with Interrogate!");
        }
        int damageToDeal        = target.stacks * MULTIPLIER;
        AbstractCharacter enemy = TurnManager.Instance.GetOtherCharacter(target.OWNER);

        // Damage enemy arguments
        NegotiationManager.Instance.AddAction(new DamageAction(enemy.GetCoreArgument(), enemy, damageToDeal, damageToDeal, this));
        List <AbstractArgument> nonCoreArgs = enemy.GetTargetableArguments();

        foreach (AbstractArgument arg in nonCoreArgs)
        {
            NegotiationManager.Instance.AddAction(new DamageAction(arg, arg.OWNER, damageToDeal, damageToDeal, this));
        }
        // Add/change Ambience
        if (this.isUpgraded)
        {
            NegotiationManager.Instance.AddAction(new SetAmbienceAction(AmbienceState.DANGEROUS));
        }
        else
        {
            NegotiationManager.Instance.AddAction(new DeployArgumentAction(this.OWNER, new ArgumentAmbientShiftAggression(), INFLUENCE));
        }

        // Destroy sacrifical argument
        NegotiationManager.Instance.AddAction(new DestroyArgumentAction(target));
    }
예제 #3
0
 public override void Play(AbstractCharacter source, AbstractArgument target)
 {
     base.Play(source, target);
     foreach (AbstractArgument argument in source.GetTargetableArguments(true))
     {
         NegotiationManager.Instance.AddAction(new ApplyPoiseAction(source, argument, POISE));
     }
 }
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        int poiseSum = 0;

        poiseSum += source.GetCoreArgument().poise;
        foreach (AbstractArgument arg in source.GetTargetableArguments())
        {
            poiseSum += arg.poise;
        }
        poiseSum = (int)Mathf.Round((float)0.5 * poiseSum);
        NegotiationManager.Instance.AddAction(new DamageAction(target, target.OWNER, MIN_DAMAGE + poiseSum, MAX_DAMAGE + poiseSum, this));
    }
예제 #5
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        NegotiationManager.Instance.AddAction(new DrawCardsAction(source, DRAW));
        if (this.isUpgraded)
        {
            NegotiationManager.Instance.AddAction(new ApplyPoiseAction(source, source.GetCoreArgument(), POISE));

            foreach (AbstractArgument arg in source.GetTargetableArguments())
            {
                NegotiationManager.Instance.AddAction(new ApplyPoiseAction(source, arg, POISE));
            }
        }
    }
예제 #6
0
    // protected so that random classes don't access this but i want the ability for certain units (aka bosses) to override attack intent calculations with some other AI
    protected virtual void CalculateAttackIntentTarget(AbstractCard attackCard)
    {
        AbstractCharacter       opponent        = TurnManager.Instance.GetOtherCharacter(this);
        List <AbstractArgument> possibleTargets = opponent.GetTargetableArguments(true);

        possibleTargets.RemoveAll(target => target.IsPlanted());      // enemies will never target planted arguments with attacks (why would they try and destroy their own planted arguments?)
        foreach (AbstractArgument target in possibleTargets)
        {
            if (target.isPriorityTarget)            // Check for and target priority arguments first
            {
                intents.Add(new EnemyIntent(attackCard, target));
                break;
            }
        }
        intents.Add(new EnemyIntent(attackCard, possibleTargets[Random.Range(0, possibleTargets.Count)]));        // If no decoy/taunt arguments are found; target a random enemy argument
    }
예제 #7
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        NegotiationManager.Instance.AddAction(new DamageAction(target.OWNER.GetCoreArgument(), target.OWNER, MIN_DAMAGE, MAX_DAMAGE, this));
        List <AbstractArgument> nonCoreArgs = target.OWNER.GetTargetableArguments();

        foreach (AbstractArgument arg in nonCoreArgs)
        {
            NegotiationManager.Instance.AddAction(new DamageAction(arg, arg.OWNER, MIN_DAMAGE, MAX_DAMAGE, this));
        }

        AbstractCharacter otherCharacter = TurnManager.Instance.GetOtherCharacter(target.OWNER);

        NegotiationManager.Instance.AddAction(new DamageAction(otherCharacter.GetCoreArgument(), otherCharacter, MIN_DAMAGE, MAX_DAMAGE, this));
        nonCoreArgs = otherCharacter.GetTargetableArguments();
        foreach (AbstractArgument arg in nonCoreArgs)
        {
            NegotiationManager.Instance.AddAction(new DamageAction(arg, arg.OWNER, MIN_DAMAGE, MAX_DAMAGE, this));
        }
    }
예제 #8
0
    public override void NotifyOfEvent(AbstractEvent eventData)
    {
        int poiseToApply = 0;

        // need to cast to access "damageDealt" field
        if (eventData.type == EventType.ARGUMENT_ATTACKED_BLOCKED)
        {
            EventArgAttackedBlocked data = eventData as EventArgAttackedBlocked;
            poiseToApply = data.damageDealt;
        }
        else
        {
            EventArgAttackedUnblocked data = eventData as EventArgAttackedUnblocked;
            poiseToApply = data.damageDealt;
        }
        NegotiationManager.Instance.AddAction(new ApplyPoiseAction(charToApplyPoiseTo, charToApplyPoiseTo.GetCoreArgument(), poiseToApply));
        foreach (AbstractArgument arg in charToApplyPoiseTo.GetTargetableArguments())
        {
            NegotiationManager.Instance.AddAction(new ApplyPoiseAction(charToApplyPoiseTo, arg, poiseToApply));
        }
    }