示例#1
0
        public bool CheckSpecial(float pastRound)
        {
            if (SkillInfo.SkillConfig.CheckSpecial != null)
            {
                castRoundAddon += pastRound;
                if (!CheckRate())
                {
                    return(false);
                }

                if (castRoundAddon < SkillInfo.SkillConfig.SpecialCd)
                {//in cd
                    return(false);
                }

                castRoundAddon = (float)(castRoundAddon - SkillInfo.SkillConfig.SpecialCd);

                SkillInfo.SkillConfig.CheckSpecial(SkillInfo, Self, Level);
                SendSkillIcon(0);
                if (SkillInfo.SkillConfig.Effect != "")
                {
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(SkillInfo.SkillConfig.Effect), Self, false));
                }
                if (SkillInfo.SkillConfig.EffectArea != "")
                {
                    SendAreaEffect(Self.Position);
                }
                return(true);
            }
            return(false);
        }
示例#2
0
 public void OnGetCardFail(bool noCard)
 {
     BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect("longly"), Tower as LiveMonster, true));
     Tower.OnMagicDamage(null, Tower.MaxHp.Source / 10, (int)CardElements.None);
     BattleManager.Instance.FlowWordQueue.Add(new FlowErrInfo(noCard ? HSErrorTypes.CardOutPunish :
                                                              HSErrorTypes.CardFullPunish, Tower.Position, 0, 3), false);
 }
示例#3
0
        public void CheckSpellEffect(bool isLeft, LiveMonster target, Point mouse)
        {
            if (spellInfo.SpellConfig.Effect != null)
            {
                Player p1 = isLeft ? BattleManager.Instance.PlayerManager.LeftPlayer : BattleManager.Instance.PlayerManager.RightPlayer;
                Player p2 = !isLeft ? BattleManager.Instance.PlayerManager.LeftPlayer : BattleManager.Instance.PlayerManager.RightPlayer;

                spellInfo.SpellConfig.Effect(spellInfo, BattleManager.Instance.MemMap, p1, p2, target, mouse, Level);

                if (!string.IsNullOrEmpty(spellInfo.SpellConfig.AreaEffect))
                {
                    //播放特效
                    RegionTypes rt       = BattleTargetManager.GetRegionType(spellInfo.SpellConfig.Target[2]);
                    var         cardSize = BattleManager.Instance.MemMap.CardSize;
                    foreach (var memMapPoint in BattleManager.Instance.MemMap.Cells)
                    {
                        var pointData = memMapPoint.ToPoint();
                        if (BattleLocationManager.IsPointInRegionType(rt, mouse.X, mouse.Y, pointData, spellInfo.SpellConfig.Range, isLeft))
                        {
                            var effectData = new ActiveEffect(EffectBook.GetEffect(spellInfo.SpellConfig.AreaEffect), pointData + new Size(cardSize / 2, cardSize / 2), false);
                            BattleManager.Instance.EffectQueue.Add(effectData);
                        }
                    }
                }
            }
        }
示例#4
0
        public void AddCardReason(IMonster mon, AddCardReason reason)
        {
            string effName = "";

            switch (reason)
            {
            case Frag.AddCardReason.DrawCardBySkillOrSpell:
                effName = "flycard";
                break;

            case Frag.AddCardReason.GetCertainCard:
                goto case Frag.AddCardReason.DrawCardBySkillOrSpell;

            case Frag.AddCardReason.Discover:
                effName = "flycard2";
                break;

            case Frag.AddCardReason.RandomCard:
                effName = "flycard3";
                break;
            }

            if (IsLeft && !string.IsNullOrEmpty(effName))
            {
                Point startPoint = new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight / 2);
                if (mon != null)
                {
                    startPoint = mon.Position;
                }
                BattleManager.Instance.EffectQueue.Add(new UIEffect(EffectBook.GetEffect(effName), startPoint,
                                                                    new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight), 16, true));
            }
        }
示例#5
0
        public static void CheckSpellEffect(Spell spell, bool isLeft, LiveMonster target, Point mouse)
        {
            MemBaseSpell spl = new MemBaseSpell(spell);

            spl.CheckSpellEffect(isLeft, target, mouse);
            if (spell.Addon != 0 && (spl.SpellConfig.Cure > 0 || spl.SpellConfig.Damage > 0))
            {
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord(string.Format("{0}倍施法!", 1 + spell.Addon), mouse, 0, "Gold", 26, 0, 0, 2, 15), false);
            }

            SpellConfig spellConfig = spell.SpellConfig;

            if (spl.HintWord != "")
            {
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord(spl.HintWord, mouse, 0, "Cyan", 26, 0, 0, 0, 15), false);
            }
            if (!string.IsNullOrEmpty(spellConfig.UnitEffect))
            {
                if (BattleTargetManager.PlayEffectOnMonster(spellConfig.Target))
                {
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(spellConfig.UnitEffect), target, false));
                }
                if (BattleTargetManager.PlayEffectOnMouse(spellConfig.Target))
                {
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(spellConfig.UnitEffect), mouse, false));
                }
            }
        }
示例#6
0
        private void OnVRegionClick(int id, int x, int y, MouseButtons button)
        {
            if (id > 0)//说明是button
            {
                var hasOpen = cardOpenArray[id - 1];
                if (hasOpen == 0)
                {
                    int cardId = UseScard();
                    vRegion.SetRegionKey(id, cardId);
                    var card = UserProfile.InfoCard.AddCard(cardId);
                    if (card.Exp != 0) //不是新卡
                    {
                        IRegionDecorator decorator = new RegionCoverDecorator(Color.FromArgb(150, Color.Black));
                        vRegion.SetRegionDecorator(id, 0, decorator);
                        decorator = new RegionTextDecorator(18, 50, 16, Color.White, true);
                        decorator.SetState("EXP+1");
                        vRegion.SetRegionDecorator(id, 1, decorator);
                    }
                    cardOpenArray[id - 1]        = cardId;
                    coverEffect[id - 1]          = new CoverEffect(EffectBook.GetEffect("transmit"), new Point(cardPos[(id - 1) * 2], cardPos[(id - 1) * 2 + 1]), new Size(120, 150));
                    coverEffect[id - 1].PlayOnce = true;
                    Invalidate();

                    var pos = vRegion.GetRegionPosition(id);
                    OnVRegionEntered(id, pos.X, pos.Y, cardId);
                }
            }
        }
示例#7
0
        public void SetInfo(DeckCard dcard)
        {
            cid      = dcard.BaseId;
            level    = dcard.Level;
            lastCell = -1;
            skills   = new List <MonsterSkill>();
            string effectName = "";

            if (cid > 0)
            {
                card = CardAssistant.GetCard(cid);
                virtualRegion.SetRegionKey(3, CardConfigManager.GetCardConfig(cid).Quality + 1);
                var jobId = CardConfigManager.GetCardConfig(cid).JobId;
                if (jobId > 0)
                {
                    jobId = ConfigData.GetJobConfig(jobId).JobIndex;
                }
                virtualRegion.SetRegionKey(4, jobId);
                card.SetData(dcard);
                if (card.GetCardType() == CardTypes.Monster)
                {
                    MonsterCard monsterCard = card as MonsterCard;
                    if (monsterCard != null)
                    {
                        CheckMonster(monsterCard, ref effectName);
                    }
                }
            }

            string nowEffectName = "";

            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(X + 20, Y + 20), new Size(160, 180));
                }
            }

            tooltip.Hide(parent);

            if (Invalidate != null)
            {
                Invalidate();
            }
        }
示例#8
0
 public void CheckCover(List <ActiveEffect> coverEffectList)
 {
     foreach (var memBaseSkill in Skills)//技能造成的特效
     {
         if (memBaseSkill.SkillConfig.Cover != "")
         {
             ActiveEffect ef = new ActiveEffect(EffectBook.GetEffect(memBaseSkill.SkillConfig.Cover), self, true);
             ef.Repeat = true;
             BattleManager.Instance.EffectQueue.Add(ef);
             coverEffectList.Add(ef);
         }
     }
 }
示例#9
0
        public void RefreshData(DbCardProduct pro)
        {
            show    = pro.Id != 0;
            product = pro;
            if (product.Id != 0)
            {
                virtualRegion.SetRegionKey(1, product.Cid);
            }

            string effectName = "";
            var    card       = CardAssistant.GetCard(product.Cid);

            if (card.GetCardType() == CardTypes.Monster)
            {
                MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(product.Cid);
                foreach (var skill in MonsterBook.GetSkillList(monsterConfig.Id))
                {
                    int         skillId     = skill.Id;
                    SkillConfig skillConfig = ConfigData.GetSkillConfig(skillId);
                    if (skillConfig.Cover != null)
                    {
                        effectName = skillConfig.Cover;
                    }
                }
                if (monsterConfig.Cover != "")
                {
                    effectName = monsterConfig.Cover;
                }
            }

            string nowEffectName = "";

            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(x + 12, y + 14), new Size(64, 84));
                }
            }

            parent.Invalidate(new Rectangle(x + 12, y + 14, 64, 84));
        }
示例#10
0
        public void CheckCover()
        {
            string cover = liveMonster.Avatar.MonsterConfig.Cover;

            if (!string.IsNullOrEmpty(cover))
            {
                ActiveEffect ef = new ActiveEffect(EffectBook.GetEffect(cover), liveMonster, true);
                ef.Repeat = true;
                BattleManager.Instance.EffectQueue.Add(ef);
                coverEffectList.Add(ef);
            }

            liveMonster.SkillManager.CheckCover(coverEffectList);
        }
示例#11
0
        public override bool CheckFly(ref NLPointF position, ref int angle)
        {
            if (target == null || !target.IsAlive || parent == null || !parent.IsAlive)
            {
                return(false);
            }

            if (FlyProc(target.Position, ref position, ref angle) == FlyCheckType.EndPoint)
            {
                parent.HitTarget(target, false);
                BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(config.EffName), target, false));
                return(false);
            }
            return(true);
        }
示例#12
0
        private void SendAreaEffect(Point pos)
        {
            //播放特效
            RegionTypes rt       = BattleTargetManager.GetRegionType(SkillInfo.SkillConfig.Target[2]);
            var         cardSize = BattleManager.Instance.MemMap.CardSize;

            foreach (var memMapPoint in BattleManager.Instance.MemMap.Cells)
            {
                var pointData = memMapPoint.ToPoint();
                if (BattleLocationManager.IsPointInRegionType(rt, pos.X, pos.Y, pointData, SkillInfo.SkillConfig.Range, Self.IsLeft))
                {
                    var effectData = new ActiveEffect(EffectBook.GetEffect(SkillInfo.SkillConfig.EffectArea), pointData + new Size(cardSize / 2, cardSize / 2), false);
                    BattleManager.Instance.EffectQueue.Add(effectData);
                }
            }
        }
示例#13
0
 public void CheckTrapOnSummon(IMonster mon, IPlayer rival)
 {
     foreach (var trap in trapList)
     {
         var trapConfig = ConfigData.GetSpellTrapConfig(trap.Id);
         if (trapConfig.EffectSummon != null)
         {
             if (self.Mp >= trapConfig.ManaCost && trapConfig.EffectSummon(self, rival, trap, mon, trap.Level))
             {
                 RemoveTrap(trap, trapConfig);
                 NLog.Debug(string.Format("RemoveTrap Summon id={0} cardId={1}", trap.Id, mon.Id));
                 BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(trapConfig.UnitEffect), mon as LiveMonster, false));
                 return;
             }
         }
     }
 }
示例#14
0
        public override bool CheckFly(ref NLPointF position, ref int angle)
        {
            if (parent == null || !parent.IsAlive)
            {
                return(false);
            }

            if (FlyProc(targetPos, ref position, ref angle) == FlyCheckType.EndPoint)
            {
                var mon = BattleLocationManager.GetPlaceMonster(targetPos.X, targetPos.Y);
                if (mon != null)
                {
                    parent.HitTarget(mon, false);
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(config.EffName), mon, false));
                }
                return(false);
            }
            return(true);
        }
示例#15
0
        public void CureRandomAlien(double rate)
        {
            IMonster target = null;

            foreach (IMonster o in Map.GetAllMonster(Position))
            {
                if (o.IsLeft == IsLeft && o.HpRate < 100 && o.Id != Id)
                {
                    if (target == null || target.HpRate > o.HpRate)
                    {
                        target = o;
                    }
                }
            }
            if (target != null)
            {
                target.AddHpRate(rate);
                BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect("yellowstar"), (LiveMonster)target, false));
            }
        }
示例#16
0
        private void CheckFight(LiveMonster nearestEnemy)
        {
            if (monster.RealRange <= GameConstants.MaxMeleeAtkRange)
            {
                monster.HitTarget(nearestEnemy, true); //近战
                BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(monster.Arrow), nearestEnemy, false));
            }
            else
            {
                BasicMissileControler controler = new TraceMissileControler(monster, nearestEnemy);
                Missile mi = new Missile(monster.Arrow, monster.Position.X, monster.Position.Y, controler);
                BattleManager.Instance.MissileQueue.Add(mi);
            }

            if (monster.RealSpd != 0) //会返回一些ats
            {
                monster.AddActionRate((float)(monster.RealSpd) * GameConstants.SpdToRate / 100);
            }
            monster.MovRound = 0;
        }
示例#17
0
 public void CheckInitialEffect()
 {
     if (SkillInfo.SkillConfig.OnAdd != null)
     {
         if (CheckRate())
         {
             onAddTriggered = true;
             SkillInfo.SkillConfig.OnAdd(SkillInfo, Self, Level);
             SendSkillIcon(0);
             if (SkillInfo.SkillConfig.Effect != "")
             {
                 BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(SkillInfo.SkillConfig.Effect), Self, false));
             }
             if (SkillInfo.SkillConfig.EffectArea != "")
             {
                 SendAreaEffect(Self.Position);
             }
         }
     }
 }
示例#18
0
        public bool CheckTrapOnUseCard(ActiveCard selectCard, Point location, IPlayer rival)
        {
            foreach (var trap in trapList)
            {
                var trapConfig = ConfigData.GetSpellTrapConfig(trap.Id);
                if (trapConfig.EffectUse != null)
                {
                    if (self.Mp >= trapConfig.ManaCost && trapConfig.EffectUse(self, rival, trap, selectCard.CardId, (int)selectCard.CardType))
                    {
                        RemoveTrap(trap, trapConfig);
                        NLog.Debug(string.Format("RemoveTrap UseCard id={0} cardId={1}", trap.Id, selectCard.CardId));
                        BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(trapConfig.UnitEffect), location, false));

                        return(true);
                    }
                }
            }

            return(false);
        }
示例#19
0
        public void OnUseCard(IPlayer caster, int cardType, int lv)
        {
            if (SkillInfo.SkillConfig.OnUseCard != null)
            {
                if (!CheckRate())
                {
                    return;
                }

                bool success = false;
                SkillInfo.SkillConfig.OnUseCard(SkillInfo, Self, caster, cardType, lv, ref success);
                if (success)
                {
                    SendSkillIcon(0);
                    if (SkillInfo.SkillConfig.Effect != "")
                    {
                        BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(SkillInfo.SkillConfig.Effect), Self, false));
                    }
                }
            }
        }
示例#20
0
        private IEnumerator DelayAttack(BaseSam atkUnit, BaseSam targetUnit)
        {
            yield return(new NLWaitForSeconds(0.2f));

            var unitPos  = new Point(targetUnit.X * TileManager.CellSize - baseX, targetUnit.Y * TileManager.CellSize - baseY);
            var unitSize = new Size(TileManager.CellSize, TileManager.CellSize);

            if (targetUnit.OnAttack(atkUnit))
            {
                var effectDie = new StaticUIImageEffect(EffectBook.GetEffect("shrink"), HSIcons.GetImage("Samurai", targetUnit.Cid), unitPos, unitSize);
                effectRun.AddEffect(effectDie);
            }

            if (atkUnit.Camp == (byte)ConfigDatas.CampConfig.Indexer.Reborn) //todo 略ws
            {
                stage = ControlStage.None;
            }

            atkUnit.IsFinished = true;//攻击并结束回合
            OnUnitFinish();
        }
示例#21
0
        private void DoAttack(int atkId, int targetId)
        {
            var atkUnit    = battleManager.GetSam(atkId);
            var targetUnit = battleManager.GetSam(targetId);

            var unitPos = new Point(targetUnit.X * TileManager.CellSize - baseX,
                                    targetUnit.Y * TileManager.CellSize - baseY);
            var unitSize = new Size(TileManager.CellSize, TileManager.CellSize);

            var effect = new StaticUIEffect(EffectBook.GetEffect("hit1"), unitPos, unitSize);

            effectRun.AddEffect(effect);

            coroutineManager.StartCoroutine(DelayAttack(atkUnit, targetUnit));

            if (atkUnit.Camp == (byte)ConfigDatas.CampConfig.Indexer.Reborn)  //todo 略ws
            {
                attackId  = 0;
                savedPath = null;
                stage     = ControlStage.AttackAnim;
            }

            refreshAll.Fire();
        }