Esempio n. 1
0
        public override void MoreAssistEffect(FightHero target)
        {
            float v = Value_1;

            if (BuffSource == target)
            {
                v = fightRoom.EffectToSelfCaculation(Value_1, Element_Type, BuffSource);
            }
            else
            {
                v = fightRoom.EffectToEnemyCaculation(Value_1, Element_Type, BuffSource, target);
            }
            float v2 = Value_1;

            if (BuffSource == target)
            {
                v2 = fightRoom.EffectToSelfCaculation(Value_2, Element_Type, BuffSource);
            }
            else
            {
                v2 = fightRoom.EffectToEnemyCaculation(Value_2, Element_Type, BuffSource, target);
            }
            target.Dodge += v * Tier;
            target.Crit  += v2 * Tier;
            base.MoreAssistEffect(target);
        }
Esempio n. 2
0
        //回血
        public void AddHp(float count, FightHero source, FightHero target)
        {
            int recover_count = count % 1 == 0 ? (int)count : (int)count + 1;

            target.Hp += recover_count;
            BroadcastMessage(null, ActionCode.TakeDamage, string.Format("{0}|{1}|{2}", target.User_Client.GetUserInfo().User_id, (int)WordType.Recover, recover_count));
        }
Esempio n. 3
0
    void RefreshItem(FightHero fh)
    {
        _itemNodeRoot.DestroyChildren();
        foreach (var pair in fh.Items)
        {
            Item       item = pair.Value;
            GameObject go   = Instantiate(_modelNode.GetNode("Item").gameObject);
            go.transform.SetParent(_itemNodeRoot);

            UINode itemNode = go.GetComponent <UINode>();
            Image  image    = itemNode.GetRef("Image").GetComponent <Image>();
            image.sprite = GameResSys.Instance.GetItem(item.Icon);
            Button btn = image.gameObject.AddComponent <Button>();
            btn.onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightItemClicked, item.Id); });
            Text num = itemNode.GetRef("Text").GetComponent <Text>();
            num.text          = item.Count.Value.ToString();
            num.raycastTarget = false;//避免遮挡
            if (item.UsableInFight)
            {
                if (item.JobLimited > 0 && item.JobLimited != ((HeroData)fh.CreatureData).Job)
                {
                    continue;
                }

                Dragable dragable = image.gameObject.AddComponent <Dragable>();
                dragable.HasTail     = true;
                dragable.TailSprite  = GameResSys.Instance.GetMask(GameConstants.CommonDragTail);
                dragable.TailColor   = item.TheColor;
                dragable.TailWidth   = 20;
                dragable.Canv        = _rootNode.GetComponent <Canvas>();
                dragable.ActionId    = item.Id;
                dragable.OnDragStart = OnDragFromItem;
            }
        }
    }
Esempio n. 4
0
        //消耗行动点和卡和抽卡
        private void DeleteAndAddCard(FightHero fightHero, string data, string effectInfo)
        {
            //火水土风雷暗
            string[] strs  = data.Split('|');
            int      count = 0;

            foreach (string s in strs)
            {
                count += int.Parse(s);
            }
            fightHero.ElementCardDict[ElementType.Fire]    -= int.Parse(strs[0]);
            fightHero.ElementCardDict[ElementType.Water]   -= int.Parse(strs[1]);
            fightHero.ElementCardDict[ElementType.Earth]   -= int.Parse(strs[2]);
            fightHero.ElementCardDict[ElementType.Wind]    -= int.Parse(strs[3]);
            fightHero.ElementCardDict[ElementType.Thunder] -= int.Parse(strs[4]);
            fightHero.ElementCardDict[ElementType.Dark]    -= int.Parse(strs[5]);

            fightHero.UsedCardDict[ElementType.Fire]    = int.Parse(strs[0]);
            fightHero.UsedCardDict[ElementType.Water]   = int.Parse(strs[1]);
            fightHero.UsedCardDict[ElementType.Earth]   = int.Parse(strs[2]);
            fightHero.UsedCardDict[ElementType.Wind]    = int.Parse(strs[3]);
            fightHero.UsedCardDict[ElementType.Thunder] = int.Parse(strs[4]);
            fightHero.UsedCardDict[ElementType.Dark]    = int.Parse(strs[5]);

            fightHero.RateOfAction -= count;
            GetElementCard(count, fightHero);


            server.SendResquest(fightHero.User_Client, ActionCode.OutCard, string.Format("{0}|{1}|#{2}", ((int)ReturnCode.Success).ToString(), fightHero.GetCardInfo(), effectInfo));
        }
Esempio n. 5
0
    /// <summary>
    /// 当前选中英雄的普通攻击
    /// </summary>
    /// <param name="p1"></param>
    /// <param name="p2"></param>
    void OnHeroAttack(object p1, object p2)
    {
        FightHero hero = _heros[_nowHeroId];

        hero.IsActioned = true;

        Enemy enemy = _enemies[0];

        int damage = hero.CreatureData.Att.Value - enemy.CreatureData.Def.Value;

        damage = System.Math.Max(1, damage);
        enemy.CreatureData.Hp.Value -= damage;
        if (enemy.CreatureData.Hp.Value <= 0)
        {
            enemy.CreatureData.Hp.Value = 0;
        }
        EventSys.Instance.AddEvent(ViewEvent.FightHeroAttack, damage);
        EventSys.Instance.AddEvent(ViewEvent.FightUpdateEnemyState, enemy);

        if (enemy.CreatureData.Hp.Value <= 0)
        {
            EnemyBeHurtDead(enemy);
        }
        else
        {
            CheckChangeTurnToEnemy();
        }
    }
Esempio n. 6
0
    /// <summary>
    /// 随机选择一个英雄
    /// </summary>
    /// <param name="heroes"></param>
    /// <returns></returns>
    FightHero SelectHero(Dictionary <int, FightHero> heroes)
    {
        //
        List <FightHero> fHeros = new List <FightHero>();

        foreach (KeyValuePair <int, FightHero> pair in heroes)
        {
            fHeros.Add(pair.Value);
        }

        //
        System.Random random    = new System.Random();
        int           randomNum = random.Next(0, fHeros.Count);

        //
        for (int i = 0; i < fHeros.Count; i++)
        {
            int       index = (randomNum + i) % fHeros.Count;
            FightHero fHero = fHeros[index];
            if (fHero.CreatureData.Hp.Value > 0)
            {
                return(fHero);
            }
        }

        Debug.LogError("All Heros Died");
        return(null);
    }
Esempio n. 7
0
    void OnUpdateRound(object p1, object p2)
    {
        int       round     = (int)p1;//暂时没地方显示Round
        FightHero fightHero = (FightHero)p2;

        OnChangeHero(fightHero, null);
    }
Esempio n. 8
0
    //嗯?
    public bool skill_100019(FightHero source, FightHero target)
    {
        float recoverValue = source.MaxHp - source.CurHp;

        source.CurHp = source.MaxHp;
        FightCtrl.AllCaculation.DamageCaculation(recoverValue / source.MaxHp, source, target, DamageResource.CollateralDamage, DamageType.Real);
        return(false);
    }
Esempio n. 9
0
    //瞬光
    public bool skill_100005(FightHero source, FightHero target)
    {
        //设置造成最终伤害系数+i
        float i = (((source.MaxHp - source.CurHp) / source.MaxHp) / 0.1f) * 0.03f;

        source.CurChaosDamageCoefficient += i;
        return(false);
    }
Esempio n. 10
0
 //助战技能
 public void Staff_skill_function(FightPhase fightPhase, FightHero source, FightHero target)
 {
     if (Staff_skill_other.isActionSkill == false)
     {
         return;
     }
     Staff_skill_other.skill_function(fightPhase, source, target);
 }
Esempio n. 11
0
        public override void OnceAssistEffect(FightHero target)
        {
            List <Client> clientList = fightRoom.GetRoomClient();
            FightHero     other      = null;

            foreach (Client c in clientList)
            {
                if (c.Fight_Hero != target)
                {
                    other = c.Fight_Hero;
                }
            }
            List <BuffCode> other_buffList  = new List <BuffCode>();
            List <BuffCode> target_buffList = new List <BuffCode>();

            other_buffList.AddRange(other.BuffDict.Keys);
            target_buffList.AddRange(target.BuffDict.Keys);
            foreach (BuffCode key in target_buffList)
            {
                if (target.BuffDict.ContainsKey(key))
                {
                    if (target.BuffDict[key].Buff_Type == BuffType.NegativeState && target.BuffDict[key].Buff_Dispel_Type == BuffDispelType.Weak)
                    {
                        target.BuffDict.Remove(key);
                    }
                }
            }
            bool isRemoveBuff = false;

            foreach (BuffCode key in other_buffList)
            {
                if (other.BuffDict.ContainsKey(key))
                {
                    if (other.BuffDict[key].Buff_Type == BuffType.PositiveState && other.BuffDict[key].Buff_Dispel_Type != BuffDispelType.Disable)
                    {
                        other.BuffDict.Remove(key);
                        isRemoveBuff = true;
                        break;
                    }
                }
            }
            if (!isRemoveBuff)
            {
                foreach (BuffCode key in target_buffList)
                {
                    if (target.BuffDict.ContainsKey(key))
                    {
                        if (target.BuffDict[key].Buff_Type == BuffType.NegativeState && target.BuffDict[key].Buff_Dispel_Type != BuffDispelType.Disable)
                        {
                            target.BuffDict.Remove(key);
                            break;
                        }
                    }
                }
            }
            base.OnceAssistEffect(target);
            base.OnceAssistEffect(target);
        }
Esempio n. 12
0
    //瞬光
    public bool skill_100005(FightHero source, FightHero target)
    {
        float i = (((source.OrgHp - source.Hp) / source.OrgHp) / 0.1f) * 0.03f;

        source.Final_Damage += i;
        Console.WriteLine("skill_100005");

        return(false);
    }
Esempio n. 13
0
 //恭候黄泉路
 public bool skill_100009(FightHero source, FightHero target)
 {
     //对敌人造成其当前生命值10%的伤害并标记目标。10S后,印记会触发,造成
     //(1加上在印记激活期间所造成的所有伤害总和的45%)风元素伤害。(该标记属于负面状态,可以被魔免清除)
     FightCtrl.AllCaculation.DamageCaculation(float.Parse(NewFightConfig.ExcelDictionaryDefine.BuffDict["Zed"].BuffValue2) * target.CurHp, source, target,
                                              DamageResource.CollateralDamage, DamageType.Real);
     BuffManager.AddAndUpdateBuff(source, target, BuffClass.Zed);
     return(false);
 }
Esempio n. 14
0
 //祈灵术
 public bool skill_100012(FightHero source, FightHero target)
 {
     if (source.CardGroup.DarkCount == 0)
     {
         return(true);
     }
     BuffManager.AddAndUpdateBuff(source, source, BuffClass.SpiritOfPrayer);
     return(false);
 }
Esempio n. 15
0
    //镜湖
    public bool skill_100001(FightHero source, FightHero target)
    {
        //设置造成最终伤害系数+i,收到最终伤害+i
        float i = (((source.MaxHp - source.CurHp) / source.MaxHp) / 0.1f) * 0.05f;

        source.CurChaosDamageCoefficient       += i;
        source.CurChaosDamageResistCoefficient -= i;
        return(true);
    }
Esempio n. 16
0
    //烈破
    public bool skill_100004(FightHero source, FightHero target)
    {
        Console.WriteLine("skill_100004");
        //20S内,造成最终伤害提升20%,受到最终伤害提升10%
        Dictionary <BuffCode, BaseBuff> buffInfoDict = source.User_Client.BaseInfoDict;

        source.User_Client.Room.SetCardEffectBuff(source, target, buffInfoDict[BuffCode.BerserkersBlood], 1, BuffTarget.Self);
        return(false);
    }
Esempio n. 17
0
    //逢魔时刻
    public bool skill_100010(FightHero source, FightHero target)
    {
        //获得一层持续10S的强化
        Console.WriteLine("skill_100010");
        Dictionary <BuffCode, BaseBuff> buffInfoDict = source.User_Client.BaseInfoDict;

        source.User_Client.Room.SetCardEffectBuff(source, target, buffInfoDict[BuffCode.Strengthen], 1, BuffTarget.Self);
        return(false);
    }
Esempio n. 18
0
 //变身
 public bool skill_100013(FightHero source, FightHero target)
 {
     if (source.CardGroup.DarkCount == 0)
     {
         return(true);
     }
     BuffManager.AddAndUpdateBuff(source, source, BuffClass.Translation);
     return(false);
 }
Esempio n. 19
0
    //灵魂隔断
    public bool skill_100014(FightHero source, FightHero target)
    {
        float sourcePercent = source.CurHp / source.MaxHp;
        float targetPercent = target.CurHp / target.MaxHp;

        source.CurHp = targetPercent * source.MaxHp;
        target.CurHp = sourcePercent * target.MaxHp;
        return(false);
    }
Esempio n. 20
0
 //暗夜降临
 public bool skill_100015(FightHero source, FightHero target)
 {
     if (source.CardGroup.DarkCount == 0)
     {
         return(true);
     }
     source.OriginalDarkStrength *= 1.05f * source.CardGroup.DarkCount;
     return(false);
 }
Esempio n. 21
0
        //抽牌
        public void GetElementCard(int count, FightHero fightHero)
        {
            Random r1 = new Random();

            for (int i = 0; i < count; i++)
            {
                int cardIndex = r1.Next(0, fightHero.ChoiceCardType.Count);
                fightHero.ElementCardDict [fightHero.ChoiceCardType[cardIndex]] += 1;
            }
        }
Esempio n. 22
0
        }                                           //进入战斗时获得的别人的助战技能

        //被动技能(技能来源,技能目标)
        public void Prossive_skill_function(FightPhase fightPhase, FightHero source, FightHero target)
        {
            if (Staff_skill_other != null && Staff_skill_other.isActionSkill == false)
            {
                Staff_skill_other.skill_function(fightPhase, source, target);
            }
            Prossive_skill_1.skill_function(fightPhase, source, target);
            Prossive_skill_2.skill_function(fightPhase, source, target);
            Prossive_skill_3.skill_function(fightPhase, source, target);
        }
Esempio n. 23
0
 //暗夜降临
 public bool skill_100015(FightHero source, FightHero target)
 {
     Console.WriteLine("skill_100015");
     if (source.UsedCardDict[ElementType.Dark] == 0)
     {
         return(true);
     }
     source.OrgDark *= 1.05f * source.UsedCardDict[ElementType.Dark];
     return(false);
 }
Esempio n. 24
0
    //灵魂隔断
    public bool skill_100014(FightHero source, FightHero target)
    {
        Console.WriteLine("skill_100014");
        float sourcePercent = source.Hp / source.OrgHp;
        float targetPercent = target.Hp / target.OrgHp;

        source.Hp = targetPercent * source.OrgHp;
        target.Hp = sourcePercent * target.OrgHp;
        return(false);
    }
Esempio n. 25
0
    //镜湖
    public bool skill_100001(FightHero source, FightHero target)
    {
        //设置造成最终伤害系数+i,收到最终伤害+i
        float i = (((source.OrgHp - source.Hp) / source.OrgHp) / 0.1f) * 0.05f;

        source.Final_Damage  += i;
        source.Final_Defense -= i;
        Console.WriteLine("skill_100001");
        return(true);
    }
Esempio n. 26
0
    //恭候黄泉路
    public bool skill_100009(FightHero source, FightHero target)
    {
        //对敌人造成其当前生命值10%的伤害并标记目标。10S后,印记会触发,造成
        source.User_Client.Room.TakeDamage(0.1f * target.Hp, DamageResource.CollateralDamage, DamageType.Real, ElementType.Wind, source, target);
        Dictionary <BuffCode, BaseBuff> buffInfoDict = source.User_Client.BaseInfoDict;

        source.User_Client.Room.SetCardEffectBuff(source, target, buffInfoDict[BuffCode.Zed], 1, BuffTarget.Other);
        Console.WriteLine("skill_100009");
        return(false);
    }
Esempio n. 27
0
 //花舞
 public bool skill_100003(FightHero source, FightHero target)
 {
     //受到火属性伤害时,对敌人施加一层持续10S的弱化效果
     if (source.FinalDamageElemType == ElementType.Fire)
     {
         BuffManager.AddAndUpdateBuff(source, target, BuffClass.Weaken);
         return(false);
     }
     return(true);
 }
Esempio n. 28
0
    void OnCreateFightView(object p1, object p2)
    {
        //create enemy
        List <Enemy> enemies = (List <Enemy>)p2;

        foreach (Enemy e in enemies)
        {
            Image cg = _enemyNode.GetRef("Cg").GetComponent <Image>();
            cg.sprite = GameResSys.Instance.GetCG(e.CreatureData.Cg);
            Slider s = _enemyNode.GetRef("HpSlider").GetComponent <Slider>();
            s.value = e.CreatureData.HpPercent;

            Dropable dropable = cg.gameObject.GetComponent <Dropable>();
            if (dropable == null)
            {
                dropable = cg.gameObject.AddComponent <Dropable>();
            }
            dropable.ActionId = e.InstanceId;
            dropable.OnDroped = OnDropOnEnemy;
        }

        //create heros
        Dictionary <int, FightHero> heros = (Dictionary <int, FightHero>)p1;

        _heroNodes = new Dictionary <int, Transform>();
        foreach (KeyValuePair <int, FightHero> pair in heros)
        {
            FightHero fh = pair.Value;

            GameObject go = Instantiate(_modelNode.GetNode("Hero").gameObject);
            go.transform.SetParent(_heroNodeRoot);

            UINode node = go.GetComponent <UINode>();
            SetHeroData(fh, node);
            node.GetRef("Hurt").gameObject.SetActive(false);
            node.GetRef("Supply").gameObject.SetActive(false);
            node.GetRef("MpSupply").gameObject.SetActive(false);
            node.GetRef("Selected").gameObject.SetActive(false);
            ShowHurt(node, -1);

            Dropable dropable = go.AddComponent <Dropable>();
            dropable.ActionId = fh.Id;
            dropable.OnDroped = OnDropOnHero;

            Button btn = node.GetRef("Icon").GetComponent <Image>().gameObject.AddComponent <Button>();
            btn.onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightSelectHero, fh.Id); });

            _heroNodes.Add(fh.Id, go.transform);
        }

        _rootNode.gameObject.SetActive(true);

        _winNode.gameObject.SetActive(false);
        _loseNode.gameObject.SetActive(false);
    }
Esempio n. 29
0
 //纸吹雪
 public bool skill_100007(FightHero source, FightHero target)
 {
     //对敌人造成直接伤害会治疗自身15 % 的已损生命值
     Console.WriteLine("skill_100007");
     if (!source.BuffDict.ContainsKey(BuffCode.Strengthen))
     {
         return(true);
     }
     source.User_Client.Room.AddHp((source.OrgHp - source.Hp) * 0.15f, source, source);
     return(false);
 }
Esempio n. 30
0
    void OnSelectHero(object p1, object p2)
    {
        int       selectId = (int)p1;
        FightHero fh       = _heros[selectId];

        if (!fh.IsActioned && fh.CreatureData.Hp.Value > 0)
        {
            _nowHeroId = selectId;
            EventSys.Instance.AddEvent(ViewEvent.SetSelectedHero, _heros[_nowHeroId]);
        }
    }