Beispiel #1
0
    protected override BaseCharacterBehavior GetTargetInRange(List <BaseCharacterBehavior> npcInArea)
    {
        if (this.toTarget != null)
        {
            return(this.toTarget);
        }
        BaseCharacterBehavior t;

        //取得作用對象
        if (npcInArea.Count == 0)
        {
            t = user;
        }
        else
        {
            if (npcInArea.Contains(user) &&
                user.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue > healingMount)
            {
                t = user;
            }
            else
            {
                npcInArea.Sort((a, b)
                               => {
                    int r = (b.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue)
                            .CompareTo(a.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue);
                    if (r == 0)
                    {
                        if (a is Player)
                        {
                            return(1);
                        }
                        if (b is Player)
                        {
                            return(-1);
                        }
                    }
                    return(r);
                });
                t = npcInArea[0];
            }
        }
        if (user is Player)
        {
            foreach (BaseCharacterBehavior t2 in npcInArea)
            {
                if (t2 == user)
                {
                    continue;
                }
                BaseSkill sk = new BaseSkill(SkillName.Heal, 3f, 0, 0, 0, 0, ConsumedAttributeName.Health, 0);
                sk.effect = this.gameObject;
                sk.SetCaster(user);
                //Debug.Log("幫 " + target.CharacterName + " 上效果");
                sk.Cast(user, t2);
            }
        }
        return(t);
    }
 protected virtual void Start()
 {
     for (int i = 0; i < skills.Length; i++)
     {
         BaseSkill sk = SkillGenerator.Instance().GetSkill(skills[i]);
         sk.SetCaster(this);
         status.Skills.Add(sk);
     }
     InvokeRepeating("UpdateStatistic", 0, UPDATE_STATISTIC_INTERVAL);
     InvokeRepeating("CheckBuff", 0, BUFF_CHECK_INTERVAL);
     InvokeRepeating("RecoverConsumedAttribute", 0, CONSUMED_ATTRIBUTE_RECOVER_INTERVAL);
     InvokeRepeating("EargleEyeImgTransformRotation", 0, 0.05f);
 }
Beispiel #3
0
    protected override BaseCharacterBehavior GetTargetInRange(List <BaseCharacterBehavior> npcInArea)
    {
        if (this.toTarget != null)
        {
            return(this.toTarget);
        }
        BaseCharacterBehavior t;

        //取得作用對象
        if (npcInArea.Count == 0)
        {
            t = null;
        }
        else
        {
            npcInArea.Sort((a, b)
                           => b.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue
                           .CompareTo(a.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue));
            t = npcInArea[0];
            //Debug.Log(npcInArea.Count);
        }
        if (user is Player)
        {
            var temp = npcInArea;
            if (npcInArea.Count > 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    var       t2 = npcInArea[UnityEngine.Random.Range(0, npcInArea.Count - 1)];
                    BaseSkill sk = Createbuff();
                    sk.effect = DebuffEffectPrefab;
                    sk.SetCaster(user);
                    //Debug.Log("First");
                    sk.Cast(t2);
                    t2.Damage(EffectDamageType, this, user);
                }
            }
        }
        return(t);
    }
Beispiel #4
0
    protected override List <BaseCharacterBehavior> GetTargetInRadious(List <BaseCharacterBehavior> npcInArea)
    {
        var random3Tar = new List <BaseCharacterBehavior>();

        for (int i = 0; i < 3; i++)
        {
            if (npcInArea.Count > 0)
            {
                if (toTarget != null)
                {
                    npcInArea.Sort((a, b) => a.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue.CompareTo(b.status.GetConsumedAttrubute(ConsumedAttributeName.Health).LossValue));
                    random3Tar.Add(npcInArea[0]);
                    npcInArea.RemoveAt(0);
                    //Debug.Log("Third");
                }
                else
                {
                    var t = npcInArea[UnityEngine.Random.Range(0, npcInArea.Count - 1)];
                    random3Tar.Add(t);
                    npcInArea.Remove(t);
                }
            }
        }
        if (user is Player && toTarget == null)
        {
            foreach (var item in random3Tar)
            {
                BaseSkill sk = new BaseSkill(SkillName.Thander, 1.5f, 0, 0, 0, 0, ConsumedAttributeName.Health, 0);
                sk.effect = ResourceLoader.Skill.GetSkillPrefab(SkillName.Thander);
                sk.SetCaster(user);
                //Debug.Log("tRAINING");
                sk.Cast(user, item);
            }
        }
        return(random3Tar);
    }