コード例 #1
0
        protected override void SequenceMainBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                //Fling the segment at the target
                CurSequenceAction = new MoveToSeqAction(SegmentTexUI, Camera.Instance.SpriteToUIPos(EntitiesAffected[0].Position), FlingTime);
                break;

            case 1:
                //Attempt damage
                InteractionResult[] interactionResult = AttemptDamage(BaseDamage, EntitiesAffected[0], Action.DamageProperties, false);

                //If the victim Superguarded, we need to reflect the segment back at the attacker and damage it
                //If the victim didn't Superguard, move on to the End branch
                if (UtilityGlobals.DefensiveActionTypesHasFlag(interactionResult[0].VictimResult.DefensiveActionsPerformed,
                                                               Enumerations.DefensiveActionTypes.Superguard) == false)
                {
                    ChangeSequenceBranch(SequenceBranch.End);
                }

                CurSequenceAction = new WaitSeqAction(0d);
                break;

            case 2:
                //Fling the segment back to the attacker
                CurSequenceAction = new MoveToSeqAction(SegmentTexUI, Camera.Instance.SpriteToUIPos(User.Position), FlingTime);

                break;

            case 3:
                //Damage the attacker then move onto the end of the sequence
                AttemptDamage(BaseDamage, User, Action.DamageProperties, false);

                CurSequenceAction = new WaitSeqAction(0d);

                ChangeSequenceBranch(SequenceBranch.End);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the result of the first successful Defensive Action performed.
        /// </summary>
        /// <param name="damage">The original damage of the attack.</param>
        /// <param name="statusesInflicted">The original set of StatusEffects inflicted.</param>
        /// <param name="damageEffects">The original DamageEffects that would affect the BattleEntity.</param>
        /// <param name="defensiveOverrides">The types of Defensive Actions to override.</param>
        /// <returns>A nullable DefensiveActionHolder? with a DefensiveAction's result if successful, otherwise null.</returns>
        public BattleGlobals.DefensiveActionHolder?GetDefensiveActionResult(int damage, StatusChanceHolder[] statusesInflicted, DamageEffects damageEffects,
                                                                            DefensiveActionTypes defensiveOverrides)
        {
            //Handle Defensive Actions
            for (int i = 0; i < DefensiveActions.Count; i++)
            {
                //Check if there are any overrides for this type of Defensive Action
                if (defensiveOverrides != DefensiveActionTypes.None &&
                    UtilityGlobals.DefensiveActionTypesHasFlag(defensiveOverrides, DefensiveActions[i].DefensiveActionType))
                {
                    Debug.Log($"{defensiveOverrides} overrode {DefensiveActions[i].DefensiveActionType}!");
                    continue;
                }

                if (DefensiveActions[i].IsSuccessful == true)
                {
                    BattleGlobals.DefensiveActionHolder holder = DefensiveActions[i].HandleSuccess(damage, statusesInflicted, damageEffects);
                    return(holder);
                }
            }

            return(null);
        }