Exemple #1
0
        protected override void GetBuffBaseFXPath(Object p_sender, EventArgs p_args, out String out_buffBaseFXPath, out String out_buffNameKey)
        {
            MonsterBuff monsterBuff = (MonsterBuff)p_sender;

            out_buffBaseFXPath = monsterBuff.Gfx;
            out_buffNameKey    = monsterBuff.Type.ToString();
        }
Exemple #2
0
 public static Timer ScheduleRemoveMonsterStatusEffect(MonsterBuff effect, uint delay)
 {
     return(Scheduler.ScheduleDelayedAction(new Action(() =>
     {
         effect.Dispose(false);
     }), delay));
 }
 internal Boolean CanAddBuff(MonsterBuff p_buff)
 {
     foreach (MonsterAbilityBase monsterAbilityBase in m_abilities)
     {
         if (monsterAbilityBase.IsForbiddenBuff(p_buff.StaticID, m_owner, false))
         {
             return(false);
         }
     }
     return(true);
 }
 private void InitBuffValues(EMonsterBuffType p_buffType)
 {
     for (Int32 i = 0; i < 10; i++)
     {
         MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(p_buffType, GetValueForLevel(i + 1, false));
         for (Int32 j = 0; j < 3; j++)
         {
             m_buffValues[i, j] = monsterBuff.GetBuffValueForTooltip(j);
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// 给敌人一点点Buff吧
 /// </summary>
 /// <param name="bfs">给什么Buff呢</param>
 /// <param name="tar_length">有多远呢</param>
 public void addMonsterBuff(MonsterBuff bfs, float tar_length)
 {
     foreach (GameObject go in monsterGOList)
     {
         float length = Vector3.Distance(playerGO.transform.localPosition, go.transform.localPosition);
         if (length <= tar_length)
         {
             go.GetComponent <MonsterBuffScript>().addBuff(bfs);//你会在那个尖括号里面的文件中找到信息
         }
     }
 }
Exemple #6
0
        protected override Boolean IsBuffAddEventForMe(Object p_sender, EventArgs p_args)
        {
            MonsterBuff monsterBuff = null;

            if (p_sender is MonsterBuff)
            {
                monsterBuff = (MonsterBuff)p_sender;
            }
            Monster monster = ((MonsterBuffUpdateEventArgs)p_args).Monster;

            return(monster == MyController && (monsterBuff == null || monster.BuffHandler.HasBuff(monsterBuff)));
        }
        private void AddTimeStopBuff(List <Object> p_targets)
        {
            MonsterBuff p_buff = BuffFactory.CreateMonsterBuff(EMonsterBuffType.TIME_STOP, 1f);

            foreach (Object obj in p_targets)
            {
                Monster monster = obj as Monster;
                if (monster != null && !monster.BuffHandler.HasBuff(EMonsterBuffType.TIME_STOP))
                {
                    monster.BuffHandler.AddBuff(p_buff);
                }
            }
        }
        private void RemoveTimeStopBuff()
        {
            m_targetBuffer.Clear();
            MonsterBuff p_buff = BuffFactory.CreateMonsterBuff(EMonsterBuffType.TIME_STOP, 1f);

            foreach (Monster monster in LegacyLogic.Instance.WorldManager.GetObjectsByTypeIterator <Monster>())
            {
                if (monster.BuffHandler.HasBuff(EMonsterBuffType.TIME_STOP))
                {
                    monster.BuffHandler.RemoveBuff(p_buff);
                }
            }
        }
        internal Boolean CanAddBuff(EMonsterBuffType p_buffType)
        {
            MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(p_buffType, 1f);

            foreach (MonsterAbilityBase monsterAbilityBase in m_abilities)
            {
                if (monsterAbilityBase.IsForbiddenBuff(monsterBuff.StaticID, m_owner, true))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #10
0
 public void AddMonsterBuff(Monster p_target, EMonsterBuffType p_monsterBuff, Single p_magicFactor)
 {
     if (p_target != null)
     {
         Character   selectedCharacter = LegacyLogic.Instance.WorldManager.Party.SelectedCharacter;
         MonsterBuff monsterBuff       = BuffFactory.CreateMonsterBuff(p_monsterBuff, p_magicFactor);
         monsterBuff.Causer = selectedCharacter;
         p_target.AddBuff(monsterBuff);
         if (SINGLE_TARGET_BUFFS.Contains(p_monsterBuff))
         {
             SingleTargetBuff(monsterBuff, p_target);
         }
     }
 }
Exemple #11
0
 protected virtual void HandleMonsterBuffs(Character p_sorcerer, SpellEventArgs p_result, Monster p_target, Single p_magicFactor)
 {
     if (p_target.CurrentHealth > 0 && m_staticData.MonsterBuffs != null)
     {
         EMonsterBuffType[] monsterBuffs = m_staticData.MonsterBuffs;
         for (Int32 i = 0; i < monsterBuffs.Length; i++)
         {
             if (monsterBuffs[i] != EMonsterBuffType.NONE)
             {
                 AddMonsterBuff(p_target, monsterBuffs[i], p_magicFactor);
                 Boolean     p_Successful = p_target.BuffHandler.HasBuff(monsterBuffs[i]);
                 MonsterBuff monsterBuff  = BuffFactory.CreateMonsterBuff(monsterBuffs[i], p_magicFactor);
                 Boolean     p_IsImmune   = !p_target.AbilityHandler.CanAddBuff(monsterBuff.Type);
                 p_result.SpellTargets.Add(new MonsterBuffTarget(p_target, monsterBuffs[i], p_Successful, p_IsImmune));
             }
         }
     }
 }
        protected override void SpawnCagePiece(Position p_position, Boolean p_isVisible)
        {
            Monster monster = new Monster((!p_isVisible) ? 718 : 717, -1);

            monster.Position  = p_position;
            monster.Direction = EDirection.EAST;
            monster.SpawnAnim = 1;
            LegacyLogic.Instance.WorldManager.MonsterGroupHandler.GetGroup(10000);
            monster.MonsterGroupID = 10000;
            if (m_grid.AddMovingEntity(monster.Position, monster))
            {
                LegacyLogic.Instance.WorldManager.SpawnObject(monster, monster.Position);
            }
            MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(EMonsterBuffType.OSCILLATION, 1f, m_level);

            monsterBuff.ScaleDuration(1f);
            ((MonsterBuffOscillation)monsterBuff).ForVisualsOnly = !p_isVisible;
            monster.BuffHandler.AddBuff(monsterBuff);
        }
Exemple #13
0
        protected override void HandleMonsters(Character p_sorcerer, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
        {
            List <Monster> objectsByType = LegacyLogic.Instance.WorldManager.GetObjectsByType <Monster>();

            foreach (Monster monster in objectsByType)
            {
                MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(EMonsterBuffType.HARMONY, p_magicFactor);
                monsterBuff.ScaleDuration(p_magicFactor);
                monster.BuffHandler.AddBuff(monsterBuff);
                p_targets.Add(monster);
                Boolean p_Successful = monster.BuffHandler.HasBuff(EMonsterBuffType.HARMONY);
                Boolean p_IsImmune   = false;
                if (!monster.AbilityHandler.CanAddBuff(monsterBuff.Type))
                {
                    p_IsImmune = true;
                }
                p_result.SpellTargets.Add(new MonsterBuffTarget(monster, EMonsterBuffType.HARMONY, p_Successful, p_IsImmune));
            }
        }
Exemple #14
0
 /// <summary>
 /// 差点忘了,我还有技能
 /// </summary>
 /// <param name="skill">呼唤技能吧</param>
 /// 技能是范围内群攻,打一个人怎么行
 public void playerSkillAttackMonster(Skill skill, MonsterBuff bfs, bool addBuff = false)
 {
     if (playerGO.GetComponent <PlayerScript>().isDead() == false)
     {
         int i = 0;
         foreach (GameObject m in monsterGOList)
         {
             if ((m.GetComponent <MonsterScript>().isDead() == false) && (m.GetComponent <MonsterMove>().getDir() <= skill.Skill_Dir))
             {
                 bloodUI(i, m, skill.Skill_attack);
                 m.GetComponent <MonsterScript>().beAttacked(skill.Skill_tattack);
                 if (addBuff)
                 {
                     m.GetComponent <MonsterBuffScript>().addBuff(bfs);
                 }
             }
             ++i;
         }
     }
 }
Exemple #15
0
        private void AfflictDebuff(Monster p_target, EMonsterBuffType p_buff, SuffixStaticData p_suffix, Boolean p_buffEndDelayed)
        {
            if (p_suffix.MagicSchool != EDamageType.NONE && p_target.CombatHandler.TestEvadeSpell(p_suffix.MagicSchool, 0))
            {
                return;
            }
            MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(p_buff, p_suffix.GetValueForLevel(m_equipment.SuffixLevel, m_equipment.ItemSlot == EItemSlot.ITEM_SLOT_2_HAND));

            monsterBuff.Causer = m_character;
            monsterBuff.DontTriggerOnFirstDamage = true;
            if (p_buffEndDelayed)
            {
                monsterBuff.Duration++;
            }
            p_target.AddBuff(monsterBuff);
            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ITEM_SUFFIX_APPLY_BUFF, new ItemSuffixApplyBuffEventArgs(p_target, p_suffix.Description, p_buff));
            MonsterBuffEntryEventArgs item = new MonsterBuffEntryEventArgs(p_target, monsterBuff, p_target.BuffHandler.HasBuff(monsterBuff));

            m_logEntries.Add(item);
        }
Exemple #16
0
    //玩家使用技能,或许该给敌人点Buff
    void skillAttack(Skill sk)
    {
        //gameManager.GetComponent<GameManager>().playerSkillAttackMonster(sk);
        float       buffCatch = Random.Range(0.0f, 50.0f);
        MonsterBuff mb        = new MonsterBuff();

        if ((buffCatch > 10.0f) && (buffCatch < 30.0f) && (sk.BuffType.MonsterBuff != Buff.MONSTERBUFF.NONE))
        {
            switch (sk.BuffType.MonsterBuff)
            {
            case Buff.MONSTERBUFF.FIREDAMAGE:
                mb.getBuff().MonsterBuff = sk.BuffType.MonsterBuff;
                mb.setMonsterBuff(mb.getBuff());
                mb.setBuffData(mb.getBuffData() * sk.Skill_attack);
                break;

            case Buff.MONSTERBUFF.ICEDAMAGE:
                mb.getBuff().MonsterBuff = sk.BuffType.MonsterBuff;
                mb.setMonsterBuff(mb.getBuff());
                break;

            case Buff.MONSTERBUFF.POISIONDAMAGE:
                mb.getBuff().MonsterBuff = sk.BuffType.MonsterBuff;
                mb.setMonsterBuff(mb.getBuff());
                mb.setBuffData(mb.getBuffData() * sk.Skill_attack);
                break;

            case Buff.MONSTERBUFF.HARDDAMAGE:
                mb.getBuff().MonsterBuff = sk.BuffType.MonsterBuff;
                break;
            }
            //gameManager.GetComponent<GameManager>().addMonsterBuff(mb, sk.Skill_Dir);
            gameManager.GetComponent <GameManager>().playerSkillAttackMonster(sk, mb, true);
        }
        else
        {
            gameManager.GetComponent <GameManager>().playerSkillAttackMonster(sk, mb);
        }
    }
Exemple #17
0
        private void Update()
        {
            if (!m_MonsterSelected)
            {
                GetCageMonster();
            }
            Int32   currentHealth = m_CageMonster.CurrentHealth;
            Boolean flag          = m_CageMonster.BuffHandler.HasBuff(EMonsterBuffType.OSCILLATION);

            if (flag && !m_Done)
            {
                MonsterBuff buff     = m_CageMonster.BuffHandler.GetBuff(EMonsterBuffType.OSCILLATION);
                Int32       duration = buff.Duration;
                if (currentHealth <= 0 && duration > 0 && !m_Done)
                {
                    GameObject gameObject = Helper.Instantiate <GameObject>(m_Cage_Destroyed_FX);
                    gameObject.transform.position = transform.position;
                    Destroy(this.gameObject, 0f);
                    m_Done = true;
                }
                if (duration == 0 && !m_Done)
                {
                    GameObject gameObject2 = Helper.Instantiate <GameObject>(m_Cage_Explode_FX);
                    gameObject2.transform.position = transform.position;
                    Destroy(gameObject, 2f);
                    m_Done = true;
                    StartCoroutine(PlayLateShakeFX());
                }
            }
            if (!flag && !m_Done && currentHealth <= 0)
            {
                GameObject gameObject3 = Helper.Instantiate <GameObject>(m_Cage_Destroyed_FX);
                gameObject3.transform.position = transform.position;
                Destroy(gameObject, 0f);
                m_Done = true;
            }
        }
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            if (p_monster.CurrentHealth == p_monster.MaxHealth)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
            Int32 num = (Int32)(p_monster.MaxHealth * (m_staticData.GetValues(m_level)[0] * 0.01f));

            p_monster.ChangeHP(num, null);
            MonsterBuff p_buff = new MonsterBuff(20, p_monster.MagicPower);
            MonsterBuffDamageEntryEventArgs p_args2 = new MonsterBuffDamageEntryEventArgs(p_buff, p_monster, new AttackResult
            {
                Result        = EResultType.HEAL,
                DamageResults =
                {
                    new DamageResult(EDamageType.HEAL, num, 0, 1f)
                }
            });

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args2);
            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
        }
 public MonsterBuffEntryEventArgs(Monster p_target, MonsterBuff p_buff, Boolean p_success)
 {
     Target     = p_target;
     Buff       = p_buff;
     Successful = p_success;
 }
Exemple #20
0
 protected Boolean Attack(List <Object> attackBuffer)
 {
     if (Controller.StaticID == 5)
     {
         GetAllTargetsInRange(attackBuffer, false, true);
     }
     else
     {
         GetAttackTargets(attackBuffer);
     }
     if (attackBuffer.Count > 0)
     {
         Damage[] array = new Damage[Brain.Data.DamageData.Length];
         for (Int32 i = 0; i < Brain.Data.DamageData.Length; i++)
         {
             DamageData p_data = DamageData.Scale(Brain.Data.DamageData[i], Brain.MagicFactor);
             array[i] = Damage.Create(p_data, 0f);
         }
         Attack  p_attack = new Attack(0f, 0f, array);
         Boolean flag     = false;
         SummonSpellEventArgs summonSpellEventArgs = new SummonSpellEventArgs();
         foreach (Object obj in attackBuffer)
         {
             BaseCombatHandler baseCombatHandler;
             if (obj is Character)
             {
                 flag = true;
                 Character character = (Character)obj;
                 baseCombatHandler = character.FightHandler;
             }
             else
             {
                 if (!(obj is Monster))
                 {
                     continue;
                 }
                 flag = true;
                 Monster monster = (Monster)obj;
                 baseCombatHandler = monster.CombatHandler;
                 if (Controller.StaticID == 3 && monster.AbilityHandler.HasAbility(EMonsterAbilityType.UNDEAD))
                 {
                     AttackResult attackResult = new AttackResult();
                     attackResult.Result = EResultType.IMMUNE;
                     summonSpellEventArgs.SpellTargets.Add(new AttackedTarget(obj, attackResult));
                     continue;
                 }
             }
             if (Controller.StaticData.DamageMod != EDamageMod.NONE && Controller.StaticData.DamageMod == EDamageMod.MultiplyByTargets)
             {
                 List <Damage> list = new List <Damage>();
                 foreach (Damage item in array)
                 {
                     var damage = item;
                     damage.Value *= attackBuffer.Count;
                     list.Add(damage);
                 }
                 p_attack = new Attack(0f, 0f, list);
             }
             AttackResult attackResult2 = baseCombatHandler.AttackEntity(p_attack, false, Brain.DamageType, Controller.StaticID == 6, Brain.IgnoreResistance, false);
             summonSpellEventArgs.SpellTargets.Add(new AttackedTarget(obj, attackResult2));
             if (attackResult2.Result != EResultType.EVADE)
             {
                 if (obj is Character)
                 {
                     Character character2 = (Character)obj;
                     character2.ApplyDamages(attackResult2, null);
                 }
                 else if (obj is Monster)
                 {
                     Monster monster2 = (Monster)obj;
                     monster2.ApplyDamages(attackResult2, Controller);
                 }
                 if (Controller.StaticData.MonsterBuffs[0] != EMonsterBuffType.NONE && obj is Monster)
                 {
                     Monster monster3 = (Monster)obj;
                     foreach (EMonsterBuffType p_type in Controller.StaticData.MonsterBuffs)
                     {
                         MonsterBuff p_buff = BuffFactory.CreateMonsterBuff(p_type, Brain.MagicFactor);
                         monster3.AddBuff(p_buff);
                     }
                 }
                 if (Controller.StaticData.PartyBuffs[0] != EPartyBuffs.NONE && obj is Character)
                 {
                     foreach (EPartyBuffs p_buffId in Controller.StaticData.PartyBuffs)
                     {
                         LegacyLogic.Instance.WorldManager.Party.Buffs.AddBuff(p_buffId, 1f);
                     }
                 }
                 if (Controller.StaticData.RemovedConditions[0] != ECondition.NONE && obj is Character)
                 {
                     Character character3 = (Character)obj;
                     foreach (ECondition p_condition in Controller.StaticData.RemovedConditions)
                     {
                         character3.ConditionHandler.RemoveCondition(p_condition);
                     }
                 }
             }
         }
         summonSpellEventArgs.Result = ((!flag) ? ESpellResult.NO_TARGET_FOUND : ESpellResult.OK);
         Controller.FeedActionLog(summonSpellEventArgs);
         LegacyLogic.Instance.EventManager.InvokeEvent(Controller, EEventType.SUMMON_CAST_SPELL, summonSpellEventArgs);
         return(flag);
     }
     return(false);
 }
Exemple #21
0
 public MonsterDamagePreventedEntryEventArgs(MonsterBuff p_buff, Int32 p_preventedDamage)
 {
     Buff            = p_buff;
     DamagePrevented = p_preventedDamage;
 }
 public MonsterBuffDamageEntryEventArgs(MonsterBuff p_buff, Object p_target, AttackResult p_attackResult)
 {
     Buff         = p_buff;
     Target       = p_target;
     AttackResult = p_attackResult;
 }
 public BuffPerformedEventArgs(MonsterBuff buff, AttackResult result)
 {
     MonsterBuff = buff;
     Result      = result;
 }
Exemple #24
0
 public void addBuff(MonsterBuff pbs)
 {
     monsterBuffList.Insert(0, pbs);
 }
Exemple #25
0
 protected void SingleTargetBuff(MonsterBuff p_monsterBuff, Monster p_newBuffTarget)
 {
     m_lastBuffTarget = p_newBuffTarget;
 }