コード例 #1
0
        public static bool AddEffect(AbilityInput effect)
        {
            for (int i = 0; i < activeEffects.Count; i++)
            {
                if (effect.selectedSpell.name == activeEffects[i].selectedSpell.name)
                {
                    if (((effect.selectedSpell.isLocationBased && effect.fireLocation == activeEffects[i].fireLocation) ||
                         (!effect.selectedSpell.isLocationBased && effect.targetedDice == activeEffects[i].targetedDice)) &&
                        !((effect.selectedSpell as Effect).isStackable))
                    {
                        if (spellPlayList.IndexOf(activeEffects[i]) > spellPlayingIndex)
                        {
                            spellPlayList.Remove(activeEffects[i]);
                        }
                        if (!effect.selectedSpell.isLocationBased)
                        {
                            activeEffects[i].targetedDice.activeEffects.Remove(activeEffects[i].selectedSpell as Effect);
                        }
                        activeEffects.RemoveAt(i);
                        break;
                    }
                }
            }
            activeEffects.Add(effect);
            if (!effect.selectedSpell.isLocationBased)
            {
                effect.targetedDice.activeEffects.Add(effect.selectedSpell as Effect);
            }
            int x = spellPlayingIndex + 1;

            while (x < spellPlayList.Count && GetAbilitySpeed(effect) < GetAbilitySpeed(spellPlayList[x]))
            {
                x++;
            }
            spellPlayList.Insert(x, effect);
            return(true);
        }
コード例 #2
0
 private static int CompareAbilitySpeeds(AbilityInput x, AbilityInput y)
 {
     if (x == null)
     {
         if (y == null)
         {
             return(0);
         }
         else
         {
             return(+1);
         }
     }
     else
     {
         if (y == null)
         {
             return(-1);
         }
         else
         {
             if (GetAbilitySpeed(x) < GetAbilitySpeed(y))
             {
                 return(+1);
             }
             else if (GetAbilitySpeed(x) > GetAbilitySpeed(y))
             {
                 return(-1);
             }
             else
             {
                 return(0);
             }
         }
     }
 }
コード例 #3
0
 private static float GetAbilitySpeed(AbilityInput ability)
 {
     return(ability.selectedDice.speed * ability.selectedSpell.speed);
 }