ApplyEffect() public method

public ApplyEffect ( Combatant, user, Combatant, target ) : bool
user Combatant,
target Combatant,
return bool
コード例 #1
0
ファイル: Status.cs プロジェクト: Chlaxi/DungeonRaiders
    public void ApplyEffect()
    {
        if (effect == null)
        {
            statusIcon.HideIcon();
            Debug.LogError("effect is not defined");
            return;
        }

        effect.ApplyEffect();
        duration--;

        if (statusIcon == null)
        {
            Debug.LogError("No icon setup for " + effect.name);
            //SetIcon(CBT.EnableIconDynamically(effect));
            return;
        }
        statusIcon.SetInfo(this);

        //redundant?
        if (IsFinished())
        {
            statusIcon.HideIcon();
            return;
        }
    }
コード例 #2
0
ファイル: HealingSkill_.cs プロジェクト: kerautret/rambarde
 public override async Task Execute(Stats source, CharacterControl target)
 {
     foreach (var t in target.GetTeam())
     {
         await StatusEffect.ApplyEffect(t, new Lazy <HealthRegen>(() => new HealthRegen(t, source.atq / atqRatio, turns)));
     }
 }
コード例 #3
0
ファイル: Skill.cs プロジェクト: kerautret/rambarde
        public async Task Execute(CharacterControl s)
        {
            _randAlly  = RandomTargetInTeam(s.team);
            _randEnemy = RandomTargetInTeam(s.team + 1);

            foreach (SkillAction action in actions)
            {
                List <CharacterControl> targets = new List <CharacterControl>();
                switch (action.targetMode)
                {
                case SkillTargetMode.OneAlly:
                    targets.Add(_randAlly);
                    break;

                case SkillTargetMode.OneEnemy:
                    targets.Add(_randEnemy);
                    break;

                case SkillTargetMode.Self:
                    targets.Add(s);
                    break;

                case SkillTargetMode.EveryAlly:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team]);
                    break;

                case SkillTargetMode.EveryEnemy:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team + 1]);
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown targetMode [" + action.targetMode + "]");
                    break;
                }

                switch (action.actionType)
                {
                case SkillActionType.Attack:
                    targets.ForEach(async t => await t.TakeDamage(action.value / 100f * s.currentStats.atq));
                    break;

                case SkillActionType.Heal:
                    targets.ForEach(async t => await t.Heal(action.value));
                    break;

                case SkillActionType.ApplyEffect:
                    targets.ForEach(async t => await StatusEffect.ApplyEffect(t, action.effectType, (int)action.value));
                    break;

                case SkillActionType.ApplyBuff:
                    targets.ForEach(async t => await StatusEffect.ApplyBuff(t, action.buffType, (int)action.value));
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown actionType [" + action.actionType + "]");
                    break;
                }
            }
        }
コード例 #4
0
ファイル: PoisonSkill_.cs プロジェクト: kerautret/rambarde
 public override async Task Execute(Stats source, CharacterControl target)
 {
     await StatusEffect.ApplyEffect(
         target,
         new Lazy <PoisonEffect>(() => new PoisonEffect(target, source.atq / atqRatio, turns)),
         turns
         );
 }
コード例 #5
0
        protected override async Task ExecuteOnTarget(CharacterControl t)
        {
            if (t is null)
            {
                return;
            }

            await StatusEffect.ApplyEffect(target, EffectType.Deaf, 2);

            await t.DecrementSkillWheel();
        }
コード例 #6
0
    /// <summary>
    /// Create the status effect game object to apply onto the target
    /// </summary>
    public static void ApplyStatusEffect(KillableGridObject caster, KillableGridObject target, GameObject statusEffectPrefab)
    {
        // Create status effect object instance to get the status effect component
        GameObject   statusEffectObject = (GameObject)Instantiate(statusEffectPrefab);
        StatusEffect statusEffect       = statusEffectObject.GetComponent <StatusEffect>();

        statusEffect.effectCaster   = caster;
        statusEffect.affectedTarget = target;

        statusEffect.ApplyEffect();
    }
コード例 #7
0
        public new async Task Execute(CharacterControl s)
        {
            CharacterControl target = RandomTargetInTeam(s.team);

            if (hasForcedTarget)
            {
                target = forcedTarget;
            }

            await StatusEffect.ApplyBuff(s, BuffType.Protection, -3);

            await StatusEffect.ApplyEffect(target, EffectType.Marked, 2);
        }
コード例 #8
0
ファイル: mod_CharacterStats.cs プロジェクト: v1ld/IEMod.pw
 private void UpdateNew()
 {
     if (this.m_bestiaryReference)
     {
         return;
     }
     this.NoiseUpdate(Time.deltaTime);
     this.DetectUpdate(Time.deltaTime);
     this.TrapCooldownTimerUpdate(Time.deltaTime);
     if (this.m_weaponSwitchingTimer >= 0f)
     {
         CharacterStats mWeaponSwitchingTimer = this;
         mWeaponSwitchingTimer.m_weaponSwitchingTimer = mWeaponSwitchingTimer.m_weaponSwitchingTimer - Time.deltaTime;
     }
     if (this.m_interruptTimer >= 0f)
     {
         CharacterStats mInterruptTimer = this;
         mInterruptTimer.m_interruptTimer = mInterruptTimer.m_interruptTimer - Time.deltaTime;
     }
     if (this.CurrentGrimoireCooldown > 0f)
     {
         CharacterStats currentGrimoireCooldown = this;
         currentGrimoireCooldown.CurrentGrimoireCooldown = currentGrimoireCooldown.CurrentGrimoireCooldown - Time.deltaTime;
         if (this.CurrentGrimoireCooldown < 0f)
         {
             this.CurrentGrimoireCooldown = 0f;
         }
     }
     if (!this.HasStatusEffectThatPausesRecoveryTimer())
     {
         float movingRecoveryMult = 1f;
         if (this.IsMoving && !IEModOptions.RemoveMovingRecovery) //IEMOD - Modded line
         {
             movingRecoveryMult = AttackData.Instance.MovingRecoveryMult;
             if (this.m_equipment != null && this.m_equipment.PrimaryAttack != null && this.m_equipment.PrimaryAttack is AttackRanged)
             {
                 movingRecoveryMult = movingRecoveryMult + this.RangedMovingRecoveryReductionPct;
             }
         }
         float single = Time.deltaTime * movingRecoveryMult;
         if (this.m_recoveryTimer > 0f)
         {
             CharacterStats mRecoveryTimer = this;
             mRecoveryTimer.m_recoveryTimer = mRecoveryTimer.m_recoveryTimer - single;
         }
         for (GenericAbility.ActivationGroup i = GenericAbility.ActivationGroup.None; i < GenericAbility.ActivationGroup.Count; i = (GenericAbility.ActivationGroup)((int)i + (int)GenericAbility.ActivationGroup.A))
         {
             if (this.m_modalCooldownTimer[(int)i] > 0f)
             {
                 this.m_modalCooldownTimer[(int)i] = this.m_modalCooldownTimer[(int)i] - single;
             }
         }
     }
     for (int j = this.m_statusEffects.Count - 1; j >= 0; j--)
     {
         if (this.m_statusEffects[j].Expired)
         {
             StatusEffect item = this.m_statusEffects[j];
             this.m_statusEffects.RemoveAt(j);
             this.m_updateTracker = true;
             if (this.OnClearStatusEffect != null)
             {
                 this.OnClearStatusEffect(base.gameObject, item);
             }
             item.Reset();
         }
     }
     for (int k = this.m_abilities.Count - 1; k >= 0; k--)
     {
         if (this.m_abilities[k] != null)
         {
             GenericAbility genericAbility = this.m_abilities[k];
             if (genericAbility.Passive && !genericAbility.Activated && genericAbility.Ready && genericAbility.IsLoaded)
             {
                 genericAbility.Activate();
                 this.m_updateTracker = true;
             }
         }
         else
         {
             this.m_abilities.RemoveAt(k);
         }
     }
     if (this.m_updateTracker)
     {
         this.m_updateTracker = false;
         this.ClearStackTracker();
         for (int l = 0; l < this.m_statusEffects.Count; l++)
         {
             StatusEffect statusEffect = this.m_statusEffects[l];
             if (!statusEffect.IsSuspended)
             {
                 bool isSuppressed = statusEffect.IsSuppressed;
                 bool flag         = false;
                 for (int m = 0; m < this.m_statusEffects.Count; m++)
                 {
                     if (l != m)
                     {
                         StatusEffect item1 = this.m_statusEffects[m];
                         if (!item1.IsSuspended)
                         {
                             if (item1.Suppresses(statusEffect, l > m))
                             {
                                 flag = true;
                                 break;
                             }
                         }
                     }
                 }
                 if (isSuppressed && !flag)
                 {
                     statusEffect.Unsuppress();
                 }
                 else if (!isSuppressed && flag)
                 {
                     statusEffect.Suppress();
                 }
             }
         }
     }
     for (int n = 0; n < this.m_statusEffects.Count; n++)
     {
         StatusEffect statusEffect1 = this.m_statusEffects[n];
         if (statusEffect1.Stackable)
         {
             if (!statusEffect1.HasBeenApplied)
             {
                 statusEffect1.ApplyEffect(base.gameObject);
             }
         }
         else if (!statusEffect1.IsSuspended && !statusEffect1.IsSuppressed)
         {
             StatusEffect trackedEffect = this.GetTrackedEffect(statusEffect1.NonstackingEffectType, statusEffect1.GetStackingKey());
             int          num           = this.m_statusEffects.IndexOf(trackedEffect);
             if (trackedEffect == null || trackedEffect.IsSuspended || statusEffect1.Suppresses(trackedEffect, num > n))
             {
                 if (trackedEffect != null && trackedEffect.Applied)
                 {
                     trackedEffect.Suppress();
                 }
                 this.AddTrackedEffect(statusEffect1);
             }
         }
     }
     if (CharacterStats.s_PlayFatigueSoundWhenNotLoading && UIInterstitialManager.Instance != null && !UIInterstitialManager.Instance.WindowActive() && !GameState.IsLoading)
     {
         IEnumerable <PartyMemberAI> onlyPrimaryPartyMembers = PartyMemberAI.OnlyPrimaryPartyMembers;
         if (onlyPrimaryPartyMembers != null)
         {
             List <PartyMemberAI>        partyMemberAIs = new List <PartyMemberAI>();
             CharacterStats              component      = null;
             IEnumerator <PartyMemberAI> enumerator     = onlyPrimaryPartyMembers.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     PartyMemberAI current = enumerator.Current;
                     if (current != null)
                     {
                         component = current.GetComponent <CharacterStats>();
                         if (!(component != null) || component.CurrentFatigueLevel == CharacterStats.FatigueLevel.None)
                         {
                             continue;
                         }
                         partyMemberAIs.Add(current);
                     }
                 }
             }
             finally
             {
                 if (enumerator == null)
                 {
                 }
                 enumerator.Dispose();
             }
             while (partyMemberAIs.Count > 0 && AfflictionData.Instance.TravelFatigueSoundTimer <= 0f)
             {
                 PartyMemberAI partyMemberAI = partyMemberAIs[OEIRandom.Index(partyMemberAIs.Count)];
                 this.PlayPartyMemberFatigueSound(partyMemberAI);
                 partyMemberAIs.Remove(partyMemberAI);
             }
             if (partyMemberAIs != null)
             {
                 partyMemberAIs.Clear();
                 partyMemberAIs = null;
             }
         }
         CharacterStats.s_PlayFatigueSoundWhenNotLoading = false;
     }
     if (this.m_stackTracker != null)
     {
         foreach (KeyValuePair <int, Dictionary <int, StatusEffect> > mStackTracker in this.m_stackTracker)
         {
             foreach (KeyValuePair <int, StatusEffect> value in mStackTracker.Value)
             {
                 StatusEffect value1 = value.Value;
                 if (value1 == null || value1.HasBeenApplied)
                 {
                     continue;
                 }
                 value1.Unsuppress();
                 value1.ApplyEffect(base.gameObject);
             }
         }
     }
     for (int o = 0; o < this.m_statusEffects.Count; o++)
     {
         this.m_statusEffects[o].Update();
     }
     if (this.IsPartyMember && GameCursor.CharacterUnderCursor && this.m_equipment)
     {
         PartyMemberAI component1 = base.GetComponent <PartyMemberAI>();
         if (component1 && component1.Selected)
         {
             int num1 = 0;
             while (num1 < this.m_abilities.Count)
             {
                 FlankingAbility flankingAbility = this.m_abilities[num1] as FlankingAbility;
                 if (!flankingAbility || !flankingAbility.CanSneakAttackEnemy(GameCursor.CharacterUnderCursor, this.m_equipment.PrimaryAttack))
                 {
                     num1++;
                 }
                 else
                 {
                     if (GameCursor.DesiredCursor == GameCursor.CursorType.Attack)
                     {
                         GameCursor.DesiredCursor = GameCursor.CursorType.AttackAdvantage;
                     }
                     GameState.s_playerCharacter.WantsAttackAdvantageCursor = true;
                     break;
                 }
             }
         }
     }
     if (this.IsPartyMember && !GameState.InCombat && !TimeController.Instance.Paused)
     {
         int maxLevelCanLevelUpTo = this.GetMaxLevelCanLevelUpTo();
         if (maxLevelCanLevelUpTo > this.Level && maxLevelCanLevelUpTo > this.m_NotifiedLevel)
         {
             GameUtilities.LaunchEffect(InGameHUD.Instance.LevelUpVfx, 1f, base.transform, null);
             UIHealthstringManager.Instance.ShowNotice(GUIUtils.GetText(807), base.gameObject, 2.5f);
             this.m_NotifiedLevel = this.GetMaxLevelCanLevelUpTo();
         }
     }
     if (CharacterStats.DebugStats)
     {
         Faction faction = base.GetComponent <Faction>();
         if (faction != null && faction.MousedOver)
         {
             UIDebug.Instance.SetText("Character Stats Debug", this.GetCharacterStatsDebugOutput(), Color.cyan);
             UIDebug.Instance.SetTextPosition("Character Stats Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
         }
     }
 }
コード例 #9
0
ファイル: mod_CharacterStats.cs プロジェクト: tspoff/IEMod.pw
 private void UpdateNew()
 {
     if (this.m_bestiaryReference)
     {
         return;
     }
     this.FatigueUpdate(Time.deltaTime * (float)WorldTime.Instance.GameSecondsPerRealSecond, this.IsMoving);
     this.NoiseUpdate(Time.deltaTime);
     this.DetectUpdate(Time.deltaTime);
     this.TrapCooldownTimerUpdate(Time.deltaTime);
     if (this.m_weaponSwitchingTimer >= 0f)
     {
         this.m_weaponSwitchingTimer -= Time.deltaTime;
     }
     if (this.m_interruptTimer >= 0f)
     {
         this.m_interruptTimer -= Time.deltaTime;
     }
     if (this.CurrentGrimoireCooldown > 0f)
     {
         this.CurrentGrimoireCooldown -= Time.deltaTime;
         if (this.CurrentGrimoireCooldown < 0f)
         {
             this.CurrentGrimoireCooldown = 0f;
         }
     }
     if (!this.HasStatusEffectThatPausesRecoveryTimer())
     {
         float num = 1f;
         if (this.IsMoving && !IEModOptions.RemoveMovingRecovery)                 //MOD
         {
             num = AttackData.Instance.MovingRecoveryMult;
             if (this.m_equipment != null && this.m_equipment.PrimaryAttack != null && this.m_equipment.PrimaryAttack is AttackRanged)
             {
                 num += this.RangedMovingRecoveryReductionPct;
             }
         }
         float num2 = Time.deltaTime * num;
         if (this.m_recoveryTimer > 0f)
         {
             this.m_recoveryTimer -= num2;
         }
         for (GenericAbility.ActivationGroup activationGroup = GenericAbility.ActivationGroup.None; activationGroup < GenericAbility.ActivationGroup.Count; activationGroup++)
         {
             if (this.m_modalCooldownTimer[(int)activationGroup] > 0f)
             {
                 this.m_modalCooldownTimer[(int)activationGroup] -= num2;
             }
         }
     }
     for (int i = this.m_statusEffects.Count - 1; i >= 0; i--)
     {
         if (this.m_statusEffects[i].Expired)
         {
             StatusEffect statusEffect = this.m_statusEffects[i];
             this.m_statusEffects.RemoveAt(i);
             this.m_updateTracker = true;
             if (this.OnClearStatusEffect != null)
             {
                 this.OnClearStatusEffect(statusEffect);
             }
             statusEffect.Reset();
         }
     }
     for (int j = this.m_abilities.Count - 1; j >= 0; j--)
     {
         if (this.m_abilities[j] == null)
         {
             this.m_abilities.RemoveAt(j);
         }
         else
         {
             GenericAbility genericAbility = this.m_abilities[j];
             if (genericAbility.Passive && !genericAbility.Activated && genericAbility.Ready && genericAbility.IsLoaded)
             {
                 genericAbility.Activate();
                 this.m_updateTracker = true;
             }
         }
     }
     if (this.m_updateTracker)
     {
         this.m_updateTracker = false;
         this.ClearStackTracker();
         for (int k = 0; k < this.m_statusEffects.Count; k++)
         {
             StatusEffect statusEffect2 = this.m_statusEffects[k];
             if (!statusEffect2.IsSuspended)
             {
                 bool isSuppressed = statusEffect2.IsSuppressed;
                 bool flag         = false;
                 for (int l = 0; l < this.m_statusEffects.Count; l++)
                 {
                     if (k != l)
                     {
                         StatusEffect statusEffect3 = this.m_statusEffects[l];
                         if (!statusEffect3.IsSuspended)
                         {
                             if (statusEffect3.Suppresses(statusEffect2, k > l))
                             {
                                 flag = true;
                                 break;
                             }
                         }
                     }
                 }
                 if (isSuppressed && !flag)
                 {
                     statusEffect2.Unsuppress();
                 }
                 else if (!isSuppressed && flag)
                 {
                     statusEffect2.Suppress();
                 }
             }
         }
     }
     for (int m = 0; m < this.m_statusEffects.Count; m++)
     {
         StatusEffect statusEffect4 = this.m_statusEffects[m];
         if (statusEffect4.Stackable && !statusEffect4.HasBeenApplied)
         {
             statusEffect4.ApplyEffect(base.gameObject);
         }
         if (!statusEffect4.Stackable && !statusEffect4.IsSuspended && this.m_statusEffects.Count > 1 && !statusEffect4.IsSuppressed)
         {
             StatusEffect trackedEffect = this.GetTrackedEffect(statusEffect4.NonstackingEffectType, statusEffect4.GetStackingKey());
             int          num3          = this.m_statusEffects.IndexOf(trackedEffect);
             if (m != num3 || trackedEffect == null || trackedEffect.IsSuspended || statusEffect4.Suppresses(trackedEffect, num3 > m))
             {
                 if (trackedEffect != null && trackedEffect.Applied)
                 {
                     trackedEffect.Suppress();
                 }
                 this.AddTrackedEffect(statusEffect4);
             }
         }
     }
     if (CharacterStats.s_PlayFatigueSoundWhenNotLoading && UIInterstitialManager.Instance != null && !UIInterstitialManager.Instance.WindowActive() && !GameState.IsLoading)
     {
         IEnumerable <PartyMemberAI> onlyPrimaryPartyMembers = PartyMemberAI.OnlyPrimaryPartyMembers;
         if (onlyPrimaryPartyMembers != null)
         {
             List <PartyMemberAI> list = new List <PartyMemberAI>();
             foreach (PartyMemberAI current in onlyPrimaryPartyMembers)
             {
                 if (!(current == null))
                 {
                     CharacterStats component = current.GetComponent <CharacterStats>();
                     if (component != null && component.GetFatigueLevel() != CharacterStats.FatigueLevel.None)
                     {
                         list.Add(current);
                     }
                 }
             }
             while (list.Count > 0 && AfflictionData.Instance.TravelFatigueSoundTimer <= 0f)
             {
                 PartyMemberAI partyMemberAI = list[UnityEngine.Random.Range(0, list.Count)];
                 this.PlayPartyMemberFatigueSound(partyMemberAI);
                 list.Remove(partyMemberAI);
             }
             if (list != null)
             {
                 list.Clear();
                 list = null;
             }
         }
         CharacterStats.s_PlayFatigueSoundWhenNotLoading = false;
     }
     if (this.m_stackTracker != null)
     {
         foreach (KeyValuePair <int, Dictionary <int, StatusEffect> > current2 in this.m_stackTracker)
         {
             foreach (KeyValuePair <int, StatusEffect> current3 in current2.Value)
             {
                 StatusEffect value = current3.Value;
                 if (value != null)
                 {
                     if (!value.HasBeenApplied)
                     {
                         value.Unsuppress();
                         value.ApplyEffect(base.gameObject);
                     }
                 }
             }
         }
     }
     for (int n = 0; n < this.m_statusEffects.Count; n++)
     {
         this.m_statusEffects[n].Update();
     }
     if (this.IsPartyMember && GameCursor.CharacterUnderCursor && this.m_equipment)
     {
         PartyMemberAI component2 = base.GetComponent <PartyMemberAI>();
         if (component2 && component2.Selected)
         {
             for (int num4 = 0; num4 < this.m_abilities.Count; num4++)
             {
                 FlankingAbility flankingAbility = this.m_abilities[num4] as FlankingAbility;
                 if (flankingAbility && flankingAbility.CanSneakAttackEnemy(GameCursor.CharacterUnderCursor, this.m_equipment.PrimaryAttack))
                 {
                     if (GameCursor.DesiredCursor == GameCursor.CursorType.Attack)
                     {
                         GameCursor.DesiredCursor = GameCursor.CursorType.AttackAdvantage;
                     }
                     GameState.s_playerCharacter.WantsAttackAdvantageCursor = true;
                     break;
                 }
             }
         }
     }
     if (this.IsPartyMember && !GameState.InCombat && !TimeController.Instance.Paused)
     {
         int maxLevelCanLevelUpTo = this.GetMaxLevelCanLevelUpTo();
         if (maxLevelCanLevelUpTo > this.Level && maxLevelCanLevelUpTo > this.m_NotifiedLevel)
         {
             GameUtilities.LaunchEffect(InGameHUD.Instance.LevelUpVfx, 1f, base.transform, null);
             UIHealthstringManager.Instance.ShowNotice(GUIUtils.GetText(807), base.gameObject, 2.5f);
             this.m_NotifiedLevel = this.GetMaxLevelCanLevelUpTo();
         }
     }
     if (CharacterStats.DebugStats)
     {
         Faction component3 = base.GetComponent <Faction>();
         if (component3 != null && component3.MousedOver)
         {
             UIDebug.Instance.SetText("Character Stats Debug", this.GetCharacterStatsDebugOutput(), Color.cyan);
             UIDebug.Instance.SetTextPosition("Character Stats Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
         }
     }
 }
コード例 #10
0
ファイル: ConBravura.cs プロジェクト: Gamagora/Rambarde-1
 protected override async Task ExecuteOnTarget(CharacterControl t)
 {
     await StatusEffect.ApplyEffect(t, EffectType.Counter, 2);
 }
コード例 #11
0
ファイル: Sforzando.cs プロジェクト: kerautret/rambarde
 protected override async Task ExecuteOnTarget(CharacterControl t)
 {
     await StatusEffect.ApplyEffect(target, EffectType.Destabilized, 2);
 }
コード例 #12
0
ファイル: Skill.cs プロジェクト: rambarde/rambarde_old
        public async Task Execute(CharacterControl s)
        {
            _randAlly  = RandomTargetInTeam(s.team);
            _randEnemy = RandomTargetInTeam(s.team + 1);

            foreach (SkillAction action in actions)
            {
                List <CharacterControl> targets = new List <CharacterControl>();
                switch (action.targetMode)
                {
                case SkillTargetMode.OneAlly:
                    targets.Add(_randAlly);
                    break;

                case SkillTargetMode.OneEnemy:
                    targets.Add(_randEnemy);
                    break;

                case SkillTargetMode.OneOtherAlly:
                    targets.Add(RandomOtherAlly(s));
                    break;

                case SkillTargetMode.EveryOtherAlly:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team]);
                    targets.Remove(s);
                    break;

                case SkillTargetMode.Self:
                    targets.Add(s);
                    break;

                case SkillTargetMode.EveryAlly:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team]);
                    break;

                case SkillTargetMode.EveryEnemy:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)(s.team + 1) % 2]);
                    break;

                case SkillTargetMode.Everyone:
                    targets = new List <CharacterControl>(
                        new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team])
                        .Union(new List <CharacterControl>(CombatManager.Instance.teams[(int)(s.team + 1) % 2])));
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown targetMode [" + action.targetMode + "]");
                    break;
                }

                switch (action.actionType)
                {
                case SkillActionType.Attack:
                    targets.ForEach(async t => await t.TakeDamage(action.value / 100f * s.currentStats.atq));
                    break;

                case SkillActionType.Heal:
                    targets.ForEach(async t => await t.Heal(action.value));
                    break;

                case SkillActionType.StealHealth:
                    targets.ForEach(async t => {
                        await t.TakeDamage(action.value / 100f * s.currentStats.atq);
                        await s.Heal(action.value / 100f * s.currentStats.atq);
                    });
                    break;

                case SkillActionType.ApplyEffect:
                    targets.ForEach(async t => await StatusEffect.ApplyEffect(t, action.effectType, (int)action.value));
                    break;

                case SkillActionType.ApplyBuff:
                    targets.ForEach(async t => await StatusEffect.ApplyBuff(t, action.buffType, (int)action.value));
                    break;

                case SkillActionType.RemoveEveryEffect:
                    targets.ForEach(t => t.statusEffects.ToList().ForEach(async e => await e.RemoveEffect()));
                    break;

                case SkillActionType.RemoveEffect:
                    targets.ForEach(async t => await t.statusEffects.First(e => e.type == action.effectType).RemoveEffect());
                    break;

                case SkillActionType.ShuffleSkillWheel:
                    targets.ForEach(async t => await t.ShuffleSkillWheel());
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown actionType [" + action.actionType + "]");
                    break;
                }
            }
        }
コード例 #13
0
        public async Task Execute(CharacterControl s)
        {
            randAlly  = RandomTargetInTeam(s.team);
            randEnemy = RandomTargetInTeam(s.team + 1);

            foreach (SkillAction action in actions)
            {
                List <CharacterControl> targets = new List <CharacterControl>();
                switch (action.targetMode)
                {
                case SkillTargetMode.OneAlly:
                    targets.Add(randAlly);
                    break;

                case SkillTargetMode.OneEnemy:
                    targets.Add(randEnemy);
                    break;

                case SkillTargetMode.OneOtherAlly:
                    targets.Add(RandomOtherAlly(s));
                    break;

                case SkillTargetMode.EveryOtherAlly:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team]);
                    targets.Remove(s);
                    break;

                case SkillTargetMode.Self:
                    targets.Add(s);
                    break;

                case SkillTargetMode.EveryAlly:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team]);
                    break;

                case SkillTargetMode.EveryEnemy:
                    targets = new List <CharacterControl>(CombatManager.Instance.teams[(int)(s.team + 1) % 2]);
                    break;

                case SkillTargetMode.Everyone:
                    targets = new List <CharacterControl>(
                        new List <CharacterControl>(CombatManager.Instance.teams[(int)s.team])
                        .Union(new List <CharacterControl>(CombatManager.Instance.teams[(int)(s.team + 1) % 2])));
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown targetMode [" + action.targetMode + "]");
                    break;
                }

                if (hasForcedTarget)
                {
                    targets.Clear();
                    targets.Add(forcedTarget);
                }

                switch (action.actionType)
                {
                case SkillActionType.Attack:
                    foreach (var t in targets)
                    {
                        await t.TakeDamage(action.value / 100f *s.currentStats.atq);

                        await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Damage,
                                                                              Dialog.GetCharacterTypeFromCharacterControl(s), CharacterType.None,
                                                                              s.characterData.clientImage, s.characterName);

                        await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Damage,
                                                                              CharacterType.None, Dialog.GetCharacterTypeFromCharacterControl(t),
                                                                              t.characterData.clientImage, t.characterName);

                        if (t.currentStats.hp.Value <= 0)
                        {
                            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Kill,
                                                                                  Dialog.GetCharacterTypeFromCharacterControl(s), CharacterType.None,
                                                                                  s.characterData.clientImage, s.characterName);

                            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Kill,
                                                                                  CharacterType.None, Dialog.GetCharacterTypeFromCharacterControl(t),
                                                                                  t.characterData.clientImage, t.characterName);
                        }
                    }
                    break;

                case SkillActionType.Heal:
                    foreach (var t in targets)
                    {
                        await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Heal,
                                                                              Dialog.GetCharacterTypeFromCharacterControl(s), CharacterType.None,
                                                                              s.characterData.clientImage, s.characterName);

                        await t.Heal(action.value);

                        await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Heal,
                                                                              CharacterType.None, Dialog.GetCharacterTypeFromCharacterControl(t),
                                                                              t.characterData.clientImage, t.characterName);
                    }
                    break;

                case SkillActionType.StealHealth:
                    targets.ForEach(async t => {
                        await t.TakeDamage(action.value / 100f * s.currentStats.atq);
                        await s.Heal(action.value / 100f * s.currentStats.atq);
                    });
                    break;

                case SkillActionType.ApplyEffect:
                    targets.ForEach(async t => await StatusEffect.ApplyEffect(t, action.effectType, (int)action.value));
                    break;

                case SkillActionType.ApplyBuff:
                    targets.ForEach(async t => await StatusEffect.ApplyBuff(t, action.buffType, (int)action.value));
                    break;

                case SkillActionType.RemoveEveryEffect:
                    targets.ForEach(t => t.statusEffects.ToList().ForEach(async e => await e.RemoveEffect()));
                    break;

                case SkillActionType.RemoveEffect:
                    targets.ForEach(async t => await t.statusEffects.First(e => e.type == action.effectType).RemoveEffect());
                    break;

                case SkillActionType.ShuffleSkillWheel:
                    targets.ForEach(async t => await t.ShuffleSkillsSlot());
                    break;

                default:
                    Debug.LogError("Tried to execute melody with unknown actionType [" + action.actionType + "]");
                    break;
                }
            }

            hasForcedTarget = false;
            forcedTarget    = null;
        }
コード例 #14
0
        public new async Task Execute(CharacterControl s)
        {
            await StatusEffect.ApplyEffect(s, EffectType.Confused, 3);

            await StatusEffect.ApplyEffect(s, EffectType.Unpredictable, 3);
        }
コード例 #15
0
ファイル: Coda.cs プロジェクト: kerautret/rambarde
        protected override async Task ExecuteOnTarget(CharacterControl t)
        {
            await StatusEffect.ApplyEffect(target, EffectType.Merciless, 1);

            await StatusEffect.ApplyEffect(target, EffectType.Rushing, 1);
        }
コード例 #16
0
ファイル: Pianissimo.cs プロジェクト: kerautret/rambarde
 protected override async Task ExecuteOnTarget(CharacterControl t)
 {
     await StatusEffect.ApplyEffect(target, EffectType.Invisible, 1);
 }
コード例 #17
0
ファイル: Staccatissimo.cs プロジェクト: Gamagora/Rambarde-1
 protected override async Task ExecuteOnTarget(CharacterControl t)
 {
     await StatusEffect.ApplyEffect(t, EffectType.HealthRegen, 5);
 }
コード例 #18
0
ファイル: DaCapo.cs プロジェクト: Gamagora/Rambarde-1
        protected override async Task ExecuteOnTarget(CharacterControl t)
        {
            await StatusEffect.ApplyEffect(t, EffectType.Grace, 1);

            await StatusEffect.ApplyEffect(t, EffectType.Disciplined, 2);
        }