public async Task <IActionResult> UpdateAbilityAsync(AbilityInfo abilityInfo)
        {
            try
            {
                //判断传过来的数据是否存在
                if (await dbContext.abilityInfoRepository.IsExistAsync(abilityInfo.DriverAbilityID))
                {
                    //找到这条数据
                    AbilityInfo ability = await dbContext.abilityInfoRepository.GetFirstInfo(abilityInfo.DriverAbilityID);

                    //修改数据
                    ability.DriverAbilityName = abilityInfo.DriverAbilityName;
                    dbContext.abilityInfoRepository.UpdateInfo(ability);
                    if (await dbContext.abilityInfoRepository.SaveAsync())
                    {
                        return(Ok(1));
                    }
                }
                _logger.LogInformation($"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}修改一条能力信息");
                //如果不存在返回错误信息
                return(NotFound());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#2
0
    void addEffect(Dictionary <string, BuffInfo> buffDict, AbilityInfo info)
    {
        var effectType = info.effectType;

        if (effectType == "none")
        {
            return;
        }
        BuffInfo buff;

        //buff.buffId = info.effectType;
        buff.value = info.getEffectValue;
        buff.round = info.effectRound;
        if (buffDict.ContainsKey(effectType))
        {
            if (info.wouldExtend)
            {
                var oldBuff = buffDict[effectType];
                oldBuff.round       += info.effectRound;
                buffDict[effectType] = oldBuff;
            }
            else
            {
                var oldBuff = buffDict[effectType];
                oldBuff.round        = info.effectRound;
                buffDict[effectType] = oldBuff;
            }
        }
        else
        {
            buffDict[effectType] = buff;
        }

        //update UI
    }
        public async Task <IActionResult> DeleteAbilityAsync(int abilityId)
        {
            try
            {
                //判断是否存在这条数据
                if (await dbContext.abilityInfoRepository.IsExistAsync(abilityId))
                {
                    //找到这条数据
                    AbilityInfo abilityInfo = await dbContext.abilityInfoRepository.GetFirstInfo(abilityId);

                    //删除这条数据
                    dbContext.abilityInfoRepository.DeleteInfo(abilityInfo);
                    if (await dbContext.abilityInfoRepository.SaveAsync())
                    {
                        return(Ok(1));
                    }
                }
                _logger.LogInformation($"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}删除一条能力信息");
                //如果不存在返回错误信息
                return(NotFound());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    IEnumerator Protected(BaseCharacter owner, AbilityInfo info)
    {
        if (info.isUse)
        {
            yield break;
        }

        owner.Audio.play(LoadManager.Instance.GetSFXData(SFXType.ElfSkill).clip, 1F, 0F, 1F);
        GameObject vfx = LoadManager.Instance.GetVFX(VFXType.ElfSkill);

        Instantiate(vfx, owner.Actor.transform).transform.localPosition = Vector3.zero;

        info.isUse       = true;
        owner.Invincible = true;
        float dur   = info.Duration;
        float timer = 0F;

        while (timer < dur)
        {
            timer += Time.deltaTime;
            yield return(null);
        }
        owner.Invincible = false;
        info.isUse       = false;
    }
示例#5
0
    public override void OnUseAbilityPlayer(AbilityInfo info)
    {
        base.OnUseAbilityPlayer(info);
        Bullet bul = Instantiate(fireballPrefab, info.castBy.transform.position + (info.playerForward * 2), Quaternion.identity);

        bul.Init(info.playerForward * vel, (int)abilityInfo.damage, CharacterCombat.instance.TeamManager, (int)abilityInfo.range);
    }
示例#6
0
    void applyEffect(AbilityInfo info, HPObject attacker)
    {
        bool isPlayer = attacker is BattlePlayer;

        //add effect
        if (info.effectRound >= 0)
        {
            if (info.applyOnSelf == isPlayer)
            {
                addEffect(playerBuffDict, info);
            }
            else
            {
                addEffect(monsterBuffDict, info);
            }
        }
        else
        {
            //instant effect
            switch (info.effectType)
            {
            case "restoreMana":

                ((BattlePlayer)attacker).restoreMana(info.getEffectValue);
                break;

            case "healPercent":
                attacker.heal(info.getEffectValue * attacker.getMaxHp() / 100);
                break;
            }
        }
    }
示例#7
0
 /// <summary>
 /// Callback to start the channel proper
 /// </summary>
 public void ChannelInitialization(NewBuff channelBuff)
 {
     // Was cancelled before the channel callback
     if (_channelInfo == null || _host == null || _host.IsDead)
     {
         if (channelBuff != null)
         {
             channelBuff.BuffHasExpired = true;
             _channelBuff = null;
         }
     }
     // Couldn't create a channel buff, so cancel
     else if (channelBuff == null)
     {
         _parent.CancelCast(0);
         _channelInfo = null;
     }
     // Successful link
     else
     {
         _channelBuff = channelBuff;
         _channelBuff.ChannelHandler = this;
         // Oil
         if (_host is Siege)
         {
             _channelBuff.OptionalObject = _host;
         }
         _host.BuffInterface.NotifyAbilityCasted(_channelInfo);
     }
 }
示例#8
0
        public Dictionary <string, AbilityInfo> GetAbilities(STUHero hero)
        {
            Dictionary <string, AbilityInfo> @return = new Dictionary <string, AbilityInfo>();

            if (hero.Abilities == null)
            {
                return(null);
            }

            foreach (Common.STUGUID ability in hero.Abilities)
            {
                AbilityInfo abi = GetAbility(ability);
                if (abi == null)
                {
                    continue;
                }

                if (abi == null)
                {
                    continue;
                }

                string name = abi.Name == null ? $"Unknown{GUID.Index(ability):X}" : $"{abi.Name}:{GUID.Index(ability):X}";
                @return[name] = abi;
            }

            return(@return);
        }
    IEnumerator Blessing(BaseCharacter owner, AbilityInfo info)
    {
        if (info.isUse)
        {
            yield break;
        }
        owner.Audio.play(LoadManager.Instance.GetSFXData(SFXType.HumanSkill).clip, 1F, 0F, 1F);
        GameObject vfx = LoadManager.Instance.GetVFX(VFXType.HumanSkill);

        Instantiate(vfx, owner.Actor.transform).transform.localPosition = Vector3.zero;

        float atk       = owner.status.Get(ActorStatus.Atk, true, true);
        float rateAtk   = info.amount[0] * 0.01F;
        float resultAtk = atk * rateAtk;

        float def       = owner.status.Get(ActorStatus.Def, true, true);
        float rateDef   = info.amount[1] * 0.01F;
        float resultDef = def * rateDef;

        // TODO : 버프 클래스 만들어야 할듯?
        owner.status.Multiplicative.Set(ActorStatus.Atk, resultAtk);
        owner.status.Multiplicative.Set(ActorStatus.Def, resultDef);

        float dur   = info.Duration;
        float timer = 0F;

        while (timer < dur)
        {
            timer += Time.deltaTime;
            yield return(null);
        }

        owner.status.Multiplicative.Set(ActorStatus.Atk, -resultAtk);
        owner.status.Multiplicative.Set(ActorStatus.Def, -resultDef);
    }
示例#10
0
 public void OnCastAbility(AbilityInfo Ab)
 {
     for (int i = 0; i < Scripts.Count; ++i)
     {
         Scripts[i].OnCastAbility(Ab);
     }
 }
 public void Add(AbilityInfo ability)
 {
     if (!abilitys.Contains(ability))
     {
         abilitys.Add(ability);
     }
 }
示例#12
0
        public static void LoadCreatureAbilities()
        {
            CreatureAbilities.Clear();

            IList <Creature_abilities> creaAbs = WorldMgr.Database.SelectAllObjects <Creature_abilities>();

            Dictionary <uint, List <NPCAbility> > temp = new Dictionary <uint, List <NPCAbility> >();

            foreach (var cAb in creaAbs)
            {
                if (!temp.ContainsKey(cAb.ProtoEntry))
                {
                    temp.Add(cAb.ProtoEntry, new List <NPCAbility>());
                }

                AbilityInfo abInfo = GetAbilityInfo(cAb.AbilityId);
                if (abInfo != null)
                {
                    temp[cAb.ProtoEntry].Add(new NPCAbility(cAb.AbilityId, abInfo.ConstantInfo.AIRange, Math.Max(abInfo.Cooldown, cAb.Cooldown), true, cAb.Text, cAb.TimeStart, cAb.ActivateAtHealthPercent, cAb.AbilityCycle, cAb.Active, cAb.ActivateOnCombatStart, cAb.RandomTarget, cAb.TargetFocus, cAb.DisableAtHealthPercent, cAb.MinRange));
                    Log.Dump("Entry: " + cAb.ProtoEntry, cAb.AbilityId + " " + abInfo.Name + " ~ Loaded");
                }
                else
                {
                    Log.Error("Entry: " + cAb.ProtoEntry, cAb.AbilityId + " ~ Failed loading");
                }
            }

            foreach (uint key in temp.Keys)
            {
                CreatureAbilities[key] = temp[key].OrderByDescending(x => x.Cooldown).ToList();
            }
        }
示例#13
0
        public static MobInfo RandomMob(MobManager mobManager, TeamColor team, GameState state)
        {
            var abilities = new List <int>();
            int maxAp     = RandomAp();
            int maxHp     = RandomHp();

            for (int i = 0; i < 2; i++)
            {
                var buff     = RandomBuff();
                var areaBuff = RandomAreaBuff();

                var cooldown = Random.Next(0, 2);

                var ability = new AbilityInfo(RandomDmg(),
                                              RandomCost(maxAp),
                                              RandomRange(),
                                              cooldown,
                                              buff,
                                              areaBuff);

                int id = mobManager.Abilities.Count;
                mobManager.Abilities.Add(ability);
                state.Cooldowns.Add(0);

                abilities.Add(id);
            }

            int iniciative = Random.Next(10);

            return(new MobInfo(team, maxHp, maxAp, iniciative, abilities));
        }
示例#14
0
 public override void BuildPacket()
 {
     PushIntoStack(trumpInfoArray.Length);
     foreach (var trumpInfo in trumpInfoArray)
     {
         isOpen = trumpLv >= trumpInfo.TrumpLv ? 1 : 0;
         SkillInfo skillInfo = TrumpHelper.GetSkillInfo(ContextUser.UserID, skillcount);
         if (skillInfo != null && skillInfo.AbilityLv >= GameConfigSet.MaxSkillLv)
         {
             isFull = 1;
         }
         else
         {
             isFull = 0;
         }
         AbilityInfo abilityInfo = TrumpHelper.GetAbilityInfo(ContextUser.UserID, skillcount);
         DataStruct  dsItem      = new DataStruct();
         dsItem.PushIntoStack(abilityInfo == null ? (short)0 : (short)abilityInfo.AbilityID);
         dsItem.PushIntoStack(abilityInfo == null ? string.Empty : abilityInfo.AbilityName.ToNotNullString());
         dsItem.PushIntoStack(abilityInfo == null ? string.Empty : abilityInfo.HeadID.ToNotNullString());
         dsItem.PushIntoStack(skillInfo == null ? (short)0 : skillInfo.AbilityLv);
         dsItem.PushIntoStack(abilityInfo == null ? string.Empty : abilityInfo.AbilityDesc.ToNotNullString());
         dsItem.PushIntoStack((short)isOpen);
         dsItem.PushIntoStack(trumpInfo.TrumpLv);
         dsItem.PushIntoStack(isFull);
         PushIntoStack(dsItem);
         skillcount++;
     }
 }
示例#15
0
    public HashSet <GridCell> GetRangeFrom(int index, GridCell location, bool ai = false)
    {
        AbilityInfo info = abilityInfo [index];

        return(Pathfinder.GetAbilityRange(location, info.ability.minRangePerLvl [info.level - 1],
                                          info.ability.maxRangePerLvl [info.level - 1], RequiresLoS(index), IsLinear(index), info.ability.requiresFreeCell, ai));
    }
示例#16
0
    public static object GetAbilityInfo(string abilityName, AbilityInfo infoWanted)
    {
        string infoType;
        switch (infoWanted)
        {
            case AbilityInfo.Offensive:
                infoType = "Offensive";
                break;

            case AbilityInfo.Range:
                infoType = "Range";
                break;

            case AbilityInfo.Splash:
                infoType = "Splash";
                break;

            case AbilityInfo.Description:
                infoType = "Description";
                break;

            default:
                infoType = "Range";
                break;
        }

        return typeof(Abilities).GetField(abilityName + infoType).GetValue(null);
    }
示例#17
0
        public void ModifyInitials(AbilityInfo abInfo)
        {
            if (_generalPreCastModifiers.Count != 0)
            {
                foreach (var modifier in _generalPreCastModifiers)
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }

            if (abInfo.ConstantInfo.MasteryTree != 0 && _speclinePreCastModifiers.ContainsKey((byte)(abInfo.ConstantInfo.MasteryTree - 1)))
            {
                foreach (var modifier in _speclinePreCastModifiers[(byte)(abInfo.ConstantInfo.MasteryTree - 1)])
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }

            if (_abilityPreCastModifiers.ContainsKey(abInfo.Entry))
            {
                foreach (var modifier in _abilityPreCastModifiers[abInfo.Entry])
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }
        }
示例#18
0
        public void ModifyFinals(AbilityInfo abInfo)
        {
            if (_generalModifiers.Count != 0)
            {
                foreach (var modifier in _generalModifiers)
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }

            if (abInfo.ConstantInfo.MasteryTree != 0 && _speclineModifiers.ContainsKey((byte)(abInfo.ConstantInfo.MasteryTree - 1)))
            {
                foreach (var modifier in _speclineModifiers[(byte)(abInfo.ConstantInfo.MasteryTree - 1)])
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }

            if (_abilityModifiers.ContainsKey(abInfo.Entry))
            {
                foreach (var modifier in _abilityModifiers[abInfo.Entry])
                {
                    modifier.ModifyAbility(_myPlayer, abInfo);
                }
            }

            if (_myPlayer.CrrInterface.ExperimentalMode)
            {
                _myPlayer.CrrInterface.ExperimentalModeModifyAbility(abInfo);
            }
        }
示例#19
0
        public void AddAbilities(ushort minBound, ushort maxBound)
        {
            if (maxBound == 0)
            {
                AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(minBound);
                if (abInfo != null && abInfo.ConstantInfo.MinimumRank <= Level)
                {
                    NPCAbility npcAbility = new NPCAbility(abInfo.Entry, abInfo.ConstantInfo.AIRange, (byte)abInfo.Cooldown, true, "");
                    AbtInterface.NPCAbilities.Add(npcAbility);
                    SendPetAbility(npcAbility);
                }
            }

            else
            {
                for (ushort i = minBound; i <= maxBound; ++i)
                {
                    AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(i);
                    if (abInfo == null || abInfo.ConstantInfo.MinimumRank > Level)
                    {
                        continue;
                    }
                    NPCAbility npcAbility = new NPCAbility(abInfo.Entry, abInfo.ConstantInfo.AIRange, (byte)abInfo.Cooldown, true, "");
                    AbtInterface.NPCAbilities.Add(npcAbility);
                    SendPetAbility(npcAbility);
                }
            }
        }
示例#20
0
        public void NodeActionComputeTest()
        {
            var game = new GameInstance(3);

            var ability   = new AbilityInfo(3, 1, 1, 0);
            var abilityId = game.AddAbilityWithInfo(ability);

            var abilities1 = new List <int>();
            var abilities2 = new List <int> {
                abilityId
            };

            var info1 = new MobInfo(TeamColor.Red, 5, 1, 0, abilities1);
            var info2 = new MobInfo(TeamColor.Blue, 5, 1, 1, abilities2);

            var m1 = game.AddMobWithInfo(info1);
            var m2 = game.AddMobWithInfo(info2);

            game.PlaceMob(m1, new AxialCoord(1, 1));
            game.PlaceMob(m2, new AxialCoord(-1, -1));

            game.PrepareEverything();

            Assert.IsTrue(game.CurrentMob.HasValue);
            Assert.AreEqual(m1, game.CurrentMob.Value);

            var firstNode = new UctNode(0, 0, UctAction.NullAction(), game);

            firstNode.PrecomputePossibleActions(true, true);

            Assert.AreEqual(3, firstNode.PossibleActions.Count);
        }
示例#21
0
        public void StateDeepCopyTest()
        {
            var game = new GameInstance(3);

            var ability   = new AbilityInfo(3, 1, 1, 0);
            var abilityId = game.AddAbilityWithInfo(ability);

            var abilities1 = new List <int>();
            var abilities2 = new List <int> {
                abilityId
            };

            var info1 = new MobInfo(TeamColor.Red, 5, 1, 0, abilities1);
            var info2 = new MobInfo(TeamColor.Blue, 5, 1, 1, abilities2);

            var m1 = game.AddMobWithInfo(info1);
            var m2 = game.AddMobWithInfo(info2);

            game.PrepareEverything();

            var copy = game.CopyStateOnly();

            TestHelpers.GameInstancesEqual(game, copy);

            var copy2 = copy.CopyStateOnly();

            ActionEvaluator.F(copy2, UctAction.AbilityUseAction(abilityId, m1, m2));

            TestHelpers.GameInstancesEqual(game, copy);

            TestHelpers.MobManagersEqual(game.MobManager, copy2.MobManager);
            TestHelpers.MapsEqual(game.Map, copy2.Map);
        }
示例#22
0
        /// <summary>Run to check whether an ability called through the DO_ABILITY packet is valid.</summary>
        public bool IsValidAbility(AbilityInfo info)
        {
            if (!HasPlayer())
            {
                return(true);
            }

            Player plr = GetPlayer();

            // Lock out abilities the player shouldn't have access to
            if (!_abilitySet.Contains(info.Entry))
            {
                return(false);
            }

            if (info.ConstantInfo.MinimumRank > plr.AdjustedLevel || info.ConstantInfo.MinimumRenown > plr.RenownRank)
            {
                return(false);
            }

            if (info.CareerLine != 0 && (plr.Info.CareerFlags & info.ConstantInfo.CareerLine) == 0)
            {
                return(false);
            }

            return(true);
        }
 public void Remove(AbilityInfo ability)
 {
     if (abilitys.Contains(ability))
     {
         abilitys.Add(ability);
     }
 }
示例#24
0
        Ability CreateAbilityFromData(string abilityName, MonsterInfo mi = null)
        {
            AbilityInfo abilityInfo = abilityData.GetAbilityByName(abilityName);

            string givenName = abilityInfo.Name;

            if (mi != null)
            {
                givenName = mi.MonsterName;
            }
            Ability ability = new Ability(givenName, abilityInfo.AbilityCD, abilityInfo.ManaCost);

            ability.SetTargetType(abilityInfo.targetType);
            ability.SetAbilityEffectType(abilityInfo.abilityEffectType);
            foreach (var effect in abilityInfo.abilityEffects)
            {
                AbilityEffect abilityEffect = new AbilityEffect()
                {
                    abilityType         = effect.abilityType,
                    damageType          = effect.damageType,
                    BaseAbilityStrength = effect.BaseAbilityStrength
                };
                if (mi != null)
                {
                    abilityEffect.monsterInfo = mi;
                }
                ability.AddToEffectList(abilityEffect);
            }
            return(ability);

            // TODO... should never be allowed to happen, look inot more robust error handling
            return(null);
        }
 public void OnUnitTurn(CombatantInfo unitInfo)
 {
     this.currentUnit     = unitInfo;
     this.SelectedAbility = unitInfo.Abilities.FirstOrDefault(x => x.Quantity > 0);
     this.setupBodies();
     this.setupUnits();
 }
    IEnumerator Move2Position(BaseCharacter owner, AbilityInfo info, Vector3 position)
    {
        owner.OrderPosition = position;
        if (owner.Order == order)
        {
            yield break;
        }

        owner.Order = order;
        float distance = Vector2.Distance(owner.Position, owner.OrderPosition);

        while (owner.Radius < distance)
        {
            if (owner.Order != order)
            {
                break;
            }
            Vector3 dir = owner.OrderPosition - owner.Position;
            owner.SetAction(Move, dir);
            distance = Vector2.Distance(owner.Position, owner.OrderPosition);
            yield return(new WaitForFixedUpdate());
        }

        info.isUse = false;
        if (owner.Order == order || owner.Order == AbilityOrder.Idle)
        {
            owner.Order = AbilityOrder.Idle;
            owner.AddAnim( );
        }
    }
示例#27
0
        //private void LoadAbility(Type abilityType, string name, string description, string texturePath)
        //{
        //    var abilityInfo = AbilityManager.New(PluginInfo.PLUGIN_GUID, name, description, abilityType, texturePath);
        //    abilityInfo.SetDefaultPart1Ability();
        //}

        private void LoadAbility(Type abilityType, string name, string description, string texturePath, string dialogue = "")
        {
            AbilityInfo abilityInfo = ScriptableObject.CreateInstance <AbilityInfo>();

            abilityInfo.powerLevel   = 0;
            abilityInfo.rulebookName = name;
            Traverse.Create(abilityInfo).Field("rulebookDescription").SetValue(description);
            abilityInfo.metaCategories = new List <AbilityMetaCategory> {
                AbilityMetaCategory.Part1Modular, AbilityMetaCategory.Part1Rulebook
            };
            abilityInfo.opponentUsable = true;

            if (dialogue.Length > 0)
            {
                abilityInfo.abilityLearnedDialogue = new DialogueEvent.LineSet(
                    new List <DialogueEvent.Line> {
                    new DialogueEvent.Line {
                        text = "dialogue"
                    }
                }
                    );
            }

            abilityInfo.canStack = false;
            var texture    = LoadTextureFromFile(texturePath);
            var abilityId  = AbilityIdentifier.GetAbilityIdentifier(PluginInfo.PLUGIN_GUID, abilityInfo.rulebookName);
            var newAbility = new NewAbility(abilityInfo, abilityType, texture, abilityId);

            Traverse.Create(abilityType).Field("ability").SetValue(newAbility.ability);
        }
示例#28
0
        /// <summary>
        /// 随机一个技能
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static AbilityInfo GetRandomAbility(string userID)
        {
            AbilityInfo changeAbility   = new AbilityInfo();
            int         abilityStyle    = 1;
            var         abilityInfoList = new ConfigCacheSet <AbilityInfo>().FindAll(m => m.AbilityStyle == abilityStyle);

            if (abilityInfoList.Count > 0)
            {
                UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID);
                if (userTrump != null && userTrump.SkillInfo.Count > 0)
                {
                    foreach (SkillInfo info in userTrump.SkillInfo)
                    {
                        AbilityInfo abilityInfo = new ConfigCacheSet <AbilityInfo>().FindKey(info.AbilityID);
                        if (abilityInfo != null)
                        {
                            abilityInfoList.Remove(abilityInfo);
                        }
                    }
                }
                int randomNum = RandomUtils.GetRandom(0, abilityInfoList.Count);
                changeAbility = abilityInfoList[randomNum];
            }
            return(changeAbility);
        }
示例#29
0
    IEnumerator Spell(BaseCharacter owner, AbilityInfo info, Vector3 position)
    {
        owner.Audio.play(LoadManager.Instance.GetSFXData(SFXType.BossSkill).clip, 1F, 0F, 1F);

        owner.caster.abilityCast = true;
        info.isUse = true;

        owner.Order = order;
        owner.SetAnim( );
        owner.Anim_Event = false;
        while (owner.Anim_Event == false)
        {
            if (owner.Order != order || owner.IsDeath)
            {
                break;
            }
            yield return(null);
        }

        int cnt = info.amount[0];

        LayerMask            layerMask = GameLayerHelper.Layer(GameLayer.Actor);
        var                  col       = new Collider2D[MAX_COUNT];
        var                  actors    = Physics2D.OverlapCircleNonAlloc(position, Range, col, layerMask);
        List <BaseCharacter> targets   = new List <BaseCharacter> ( );

        for (int i = 0; i < actors; ++i)
        {
            BaseCharacter character = col[i].GetComponentInParent <BaseCharacter> ( );
            if (character == null || character.Equals(owner) || owner.Owner.IsAlliance(character.Owner) || character.IsDeath)
            {
                continue;
            }
            targets.Insert(Random.Range(0, targets.Count + 1), character);
        }

        GameObject vfx = LoadManager.Instance.GetVFX(VFXType.BossSkill);

        foreach (var t in targets)
        {
            Instantiate(vfx, t.Position, Quaternion.identity);
            DamageCalculator.DamageInfo damageInfo = new DamageCalculator.DamageInfo(DamageCalculator.DamageType.Magic);
            damageInfo.damage = 99999999;
            owner.damageCalculator.Damaged(t, damageInfo);
            if (--cnt == 0)
            {
                break;
            }
        }

        if (owner.Order == order || owner.Order == AbilityOrder.Idle)
        {
            owner.Order = AbilityOrder.Idle;
            owner.AddAnim( );
        }

        info.isUse = false;
        owner.caster.abilityCast = false;
    }
示例#30
0
        public bool StartCastAtPos(Unit instigator, ushort abilityID, Point3D worldPos, ushort zoneId, byte castSequence)
        {
            if (PreventCasting)
            {
                if (_Owner is Player)
                {
                    Player owner = _Owner as Player;
                    owner?.SendClientMessage("A developer has disabled all abilities.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                }
                return(false);
            }

            // Allow only interruption of channeled skills of a different ID to the skill being used
            if (IsCasting() && (!_abilityProcessor.IsChannelling || _abilityProcessor.AbInfo.Entry == abilityID))
            {
                return(false);
            }

            AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(abilityID);

            if (abInfo == null || (abInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM && !IsValidAbility(abInfo)))
            {
                return(false);
            }
            try
            {
                if (AbilityMgr.HasCommandsFor(abilityID) || abInfo.ConstantInfo.ChannelID != 0)
                {
                    if (_abilityProcessor == null)
                    {
                        _abilityProcessor = new AbilityProcessor(_unitOwner, this);
                    }

                    abInfo.Instigator = instigator;

                    if (!_abilityProcessor.HasInfo())
                    {
                        _abilityProcessor.StartAbilityAtPos(abInfo, castSequence, worldPos, zoneId);
                    }
                    return(true);
                }
                if (_Owner is Player)
                {
                    var owner = _Owner as Player;
                    owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " has no implementation.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                }
                return(false);
            }

            catch (Exception e)
            {
                if (_Owner is Player)
                {
                    var owner = _Owner as Player;
                    owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " threw an unhandled " + e.GetType().Name + " from " + e.TargetSite + ".");
                }
                return(false);
            }
        }
示例#31
0
    public override void OnUseAbilityPlayer(AbilityInfo info)
    {
        base.OnUseAbilityPlayer(info);
        ArcLauncher GO = Instantiate(bomb, info.castBy.transform.position + (info.playerForward * 2), bomb.transform.rotation);

        GO.SetTarget(info.hitPoint);
        GO.GetComponent <OnCollisionSpawner>().OnObjectSpawned += SetPoisionTeam;
    }
示例#32
0
        private static AOSAbility GetAbility( int item, AbilityInfo[] list )
        {
            for (int a=0;a<list.Length;a++)
            {
                if ( list[a].HasItem( item ) )
                    return list[a].Ability;
            }

            return AOSAbility.Invalid;
        }