public Color GetMonsterColor(LiveMonster lm, int mouseX, int mouseY) { if (!Active) { return(Color.White); } foreach (var regionData in dataList) { if (regionData.Color == Color.Red && lm.IsLeft) { continue; } if (regionData.Color == Color.Green && !lm.IsLeft) { continue; } if (!BattleLocationManager.IsPointInRegionType(regionData.Type, mouseX, mouseY, lm.Position, regionData.Range, true)) { //magicregion永远为leftplayer服务 continue; } return(regionData.Color); } return(Color.White); }
public MonsterAuro(LiveMonster mon, int buff, int lv, string tar) { self = mon; buffId = buff; level = lv; target = tar; }
public TrueWeapon(LiveMonster lm, int level, Weapon wpn) { self = lm; avatar = wpn; Level = level; Life = wpn.Dura; }
public void DoSpell(LiveMonster target, ActiveCard card, Point location) { if (!BeforeUseCard(card, location)) { return; } try { Spell spell = new Spell(card.CardId); spell.Addon = SpellEffectAddon; spell.UpgradeToLevel(card.Level); if (!card.IsHeroSkill) { BattleManager.Instance.StatisticData.GetPlayer(IsLeft).SpellAdd++; } SpellAssistant.CheckSpellEffect(spell, IsLeft, target, location); if (SpikeManager.HasSpike("mirrorspell")) { Rival.AddCard(null, card.CardId, card.Level); } } catch (Exception e) { NLog.Warn(e); BattleManager.Instance.FlowWordQueue.Add(new FlowWord("未知错误", location, 0, "Red", 26, 0, 0, 2, 15), false); return; } AfterUseCard(card); CardManager.DeleteCardAt(SelectId); }
public void UseSideKick(LiveMonster lm, ActiveCard card) { if (!BeforeUseCard(card, lm.Position)) { return; } try { Monster mon = new Monster(card.CardId); mon.UpgradeToLevel(card.Level); if (!card.IsHeroSkill) { BattleManager.Instance.StatisticData.GetPlayer(IsLeft).MonsterAdd++; } var tWeapon = new SideKickWeapon(lm, card.Level, mon); lm.AddWeapon(tWeapon); } catch (Exception e) { NLog.Warn(e); BattleManager.Instance.FlowWordQueue.Add(new FlowWord("未知错误", lm.Position, 0, "Red", 26, 0, 0, 2, 15), false); return; } AfterUseCard(card); CardManager.DeleteCardAt(SelectId); }
public CardFastBattleResult StartGame(int left, int right, int leftWeapon)//初始化游戏 { BattleManager.Instance.Init(); BattleManager.Instance.EffectQueue.SetFast(); BattleManager.Instance.FlowWordQueue.SetFast(); BattleManager.Instance.PlayerManager.LeftPlayer = new IdlePlayer(true); BattleManager.Instance.PlayerManager.RightPlayer = new IdlePlayer(false); BattleManager.Instance.MemMap = new MemRowColumnMap("default", TileConfig.Indexer.DefaultTile); roundMark = 0; int size = BattleManager.Instance.MemMap.CardSize; BattleManager.Instance.StatisticData.Round = 0; LiveMonster newMon = new LiveMonster(1, new Monster(left), new Point(3 * size, 2 * size), true); //if (leftWeapon > 0) //{ // newMon.AddWeapon(leftWeapon, 1, 0); //} LiveMonster newMon2 = new LiveMonster(1, new Monster(right), new Point(6 * size, 2 * size), false); BattleManager.Instance.MonsterQueue.Add(newMon); BattleManager.Instance.MonsterQueue.Add(newMon2); CardFastBattleResult result; TimerProc(out result); return(result); }
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); } } } } }
public ActiveEffect(Effect effect, Point p, bool isMute) : base(effect, isMute) { this.mon = null; this.point = p; frameId = -1; }
public void Draw(Graphics g, MagicRegion magicRegion, CardVisualRegion visualRegion, int mouseX, int mouseY, bool isMouseIn) { MemMap.Draw(g);//画地图 visualRegion.Draw(g); if (magicRegion.Active && isMouseIn) { magicRegion.Draw(g, RoundMark, mouseX, mouseY); } for (int i = 0; i < MonsterQueue.Count; i++) { LiveMonster monster = MonsterQueue[i]; Color color = Color.White; if (isMouseIn) { color = magicRegion.GetMonsterColor(monster, mouseX, mouseY); } monster.DrawOnBattle(g, color);//画怪物 } for (int i = 0; i < MissileQueue.Count; i++) { MissileQueue[i].Draw(g);//画导弹 } for (int i = 0; i < EffectQueue.Count; i++) { EffectQueue[i].Draw(g);//画特效 } for (int i = 0; i < FlowWordQueue.Count; i++) { FlowWordQueue[i].Draw(g);//画飘字 } }
private LiveMonster GetNearestEnemy(bool isLeft, Point mouse) { LiveMonster target = null; int dis = int.MaxValue; int rate = 0; foreach (var mon in BattleManager.Instance.MonsterQueue.Enumerator) { if (mon.IsGhost) { continue; } if (isLeft != mon.Owner.IsLeft) { var tpDis = MathTool.GetDistance(mon.Position, mouse); if (tpDis / BattleManager.Instance.MemMap.CardSize * 10 > mon.RealRange && (isLeft && mon.Position.X < mouse.X || !isLeft && mon.Position.X > mouse.X)) //不管身后的敌人 { continue; } var targetRate = GetMonsterRate(mon); if (tpDis < dis || tpDis == dis && targetRate > rate) { dis = tpDis; target = mon; rate = targetRate; } } } return(target); }
public void OnAddBuff(LiveMonster src) { if (BuffConfig.OnAdd != null) { BuffConfig.OnAdd(src); } }
public void OnRemoveBuff(LiveMonster src) { if (BuffConfig.OnRemove != null) { BuffConfig.OnRemove(src); } }
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)); } } }
public void CheckDamage(LiveMonster src, LiveMonster dest, bool isActive, HitDamage damage, ref bool nodef, int key) { if (SkillInfo.SkillConfig.CheckDamage != null) { SkillInfo.SkillConfig.CheckDamage(src, dest, isActive, damage, ref nodef, Level); SendSkillIcon(key); } }
public void CheckHit(LiveMonster src, LiveMonster dest, ref int hit, int key) { if (SkillInfo.SkillConfig.CheckHit != null) { SkillInfo.SkillConfig.CheckHit(src, dest, ref hit, Level); SendSkillIcon(key); } }
private void Remove(LiveMonster mon) { mon.OwnerPlayer.State.CheckMonsterEvent(false, mon); if (BattleManager.Instance.MemMap.GetMouseCell(mon.Position.X, mon.Position.Y).Owner == -mon.Id) { BattleLocationManager.ClearCellOwner(mon.Position.X, mon.Position.Y); } monsters.Remove(mon); }
private void panelBattle_MouseClick(object sender, MouseEventArgs e) { if (BattleManager.Instance.PlayerManager.LeftPlayer == null) { return; } if (isGamePaused) { return; } int cardSize = BattleManager.Instance.MemMap.CardSize; if (e.Button == MouseButtons.Left) { if (leftSelectCard != null && (myCursor.Name == "summon" || myCursor.Name == "equip" || myCursor.Name == "cast" || myCursor.Name == "sidekick")) { int result; if ((result = BattleManager.Instance.PlayerManager.LeftPlayer.CheckUseCard(leftSelectCard, BattleManager.Instance.PlayerManager.LeftPlayer, BattleManager.Instance.PlayerManager.RightPlayer)) != HSErrorTypes.OK) { BattleManager.Instance.FlowWordQueue.Add(new FlowErrInfo(result, new Point(mouseX, mouseY), 0, 0), false); return; } LiveMonster lm = BattleLocationManager.GetPlaceMonster(mouseX, mouseY); if (myCursor.Name == "summon" && lm == null) { var pos = new Point(mouseX / cardSize * cardSize, mouseY / cardSize * cardSize); BattleManager.Instance.PlayerManager.LeftPlayer.UseMonster(leftSelectCard, pos); } else if (myCursor.Name == "equip" && lm != null) { BattleManager.Instance.PlayerManager.LeftPlayer.UseWeapon(lm, leftSelectCard); } else if (myCursor.Name == "sidekick" && lm != null) { BattleManager.Instance.PlayerManager.LeftPlayer.UseSideKick(lm, leftSelectCard); } else if (myCursor.Name == "cast") { BattleManager.Instance.PlayerManager.LeftPlayer.DoSpell(lm, leftSelectCard, e.Location); } var cardData = CardConfigManager.GetCardConfig(leftSelectCard.CardId); UserProfile.Profile.OnUseCard(cardData.Star, 0, cardData.TypeSub); cardsArray1.DisSelectCard(); } } else if (e.Button == MouseButtons.Right) { leftSelectCard = null; cardsArray1.DisSelectCard(); } }
private void CheckCursor() { string cursorname = "default"; magicRegion.Active = false; if (leftSelectCard != null) { if (leftSelectCard.CardType == CardTypes.Monster) { if (BattleLocationManager.IsPlaceCanSummon(leftSelectCard.CardId, mouseX, mouseY, true)) { cursorname = "summon"; magicRegion.Active = true; } else { var placeMon = BattleLocationManager.GetPlaceMonster(mouseX, mouseY); if (placeMon != null && placeMon.IsLeft && !placeMon.Avatar.MonsterConfig.IsBuilding) { if (MonsterBook.HasTag(leftSelectCard.CardId, "sidekicker") || MonsterBook.HasTag(placeMon.CardId, "sidekickee") || BattleManager.Instance.PlayerManager.LeftPlayer.SpikeManager.HasSpike("sidekickall")) { cursorname = "sidekick"; } } } } else if (leftSelectCard.CardType == CardTypes.Weapon) { LiveMonster lm = BattleLocationManager.GetPlaceMonster(mouseX, mouseY); if (lm != null && lm.CanAddWeapon() && lm.IsLeft) { cursorname = "equip"; } } else if (leftSelectCard.CardType == CardTypes.Spell) { if (mouseX > 0) { SpellConfig spellConfig = ConfigData.GetSpellConfig(leftSelectCard.CardId); if (BattleLocationManager.IsPlaceCanCast(mouseX, mouseY, spellConfig.Target)) { magicRegion.Active = true; cursorname = "cast"; } else { cursorname = "nocast"; } } } } myCursor.ChangeCursor(cursorname); }
/// <summary> /// 判定伤害技能影响 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="isActive">是否主动</param> /// <param name="damage">伤害值</param> /// <param name="nodef">无视防御</param> public void CheckDamage(LiveMonster src, LiveMonster dest, bool isActive, HitDamage damage, ref bool nodef) { foreach (var skill in Skills.ToArray()) { var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id); if (skill.IsBurst(key)) { skill.CheckDamage(src, dest, isActive, damage, ref nodef, key); } } }
public void AddMonster(int cardId, int level, Point location) { int size = BattleManager.Instance.MemMap.CardSize; var truePos = new Point(location.X / size * size, location.Y / size * size); var mon = new Monster(cardId); mon.UpgradeToLevel(level); LiveMonster newMon = new LiveMonster(level, mon, truePos, IsLeft); BattleManager.Instance.MonsterQueue.Add(newMon); }
/// <summary> /// 判定hit技能影响 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="rhit">命中</param> public void CheckHit(LiveMonster src, LiveMonster dest, ref int rhit) { foreach (var skill in Skills.ToArray()) { var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id); if (skill.IsBurst(key)) { skill.CheckHit(src, dest, ref rhit, key); } } }
private int GetMonsterRate(LiveMonster mon) { int score = 10000 - mon.Hp; score += mon.RealRange * 10;//优先打远程单位 if (MonsterBook.HasTag(mon.CardId, "taunt")) { score += 10000; } return(score); }
/// <summary> /// 判定伤害后技能影响 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="damage">伤害值</param> public void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage damage) { foreach (var skill in Skills.ToArray()) { var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id); if (skill.IsBurst(key)) { skill.CheckHitEffectAfter(src, dest, damage, key); } } }
/// <summary> /// 判定技能释放状态 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="isMelee">是否是近战攻击(否则远程)</param> public void CheckBurst(LiveMonster src, LiveMonster dest, bool isMelee) { foreach (var skill in Skills.ToArray()) { if (InForget && skill.Type != SkillSourceTypes.Weapon) { continue; } skill.CheckBurst(src, dest, isMelee); } }
public static void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage dam) { if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { src.SkillManager.CheckHitEffectAfter(src, dest, dam); } if (!dest.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { dest.SkillManager.CheckHitEffectAfter(src, dest, dam); } }
public void ReviveUnit(IPlayer player, IMonster mon, int addHp) { LiveMonster lm = mon as LiveMonster; lm.Revive(); lm.DeleteWeapon(); lm.AddHp(addHp); if (lm.Owner != player)//复活了对方的怪,就招过来了 { lm.Rebel(); } }
/// <summary> /// 看下光环的影响和地形影响 /// </summary> public static void CheckAuroState(LiveMonster src, bool tileMatching) { if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { src.CheckAuroEffect(); } if (tileMatching || src.HasSkill(GameConstants.SkillTileId))//地形 { src.AddBuff(BuffConfig.Indexer.Tile, 1, 0.05); } }
public Color GetColor(LiveMonster lm, int mouseX, int mouseY) { if (Type == RegionType.None || Type == RegionType.Grid) { return(Color.White); } if (color == Color.Red && !lm.GoLeft) { return(Color.White); } if (color == Color.Green && lm.GoLeft) { return(Color.White); } if (Type == RegionType.Circle) { if (HSMath.GetDistance(mouseX, mouseY, lm.Position.X + 50, lm.Position.Y * 100 + 50) > length * 10) { return(Color.White); } } else if (Type == RegionType.Rect) { if (mouseX < lm.Position.X + 50 - length * 10 || mouseX > lm.Position.X + 50 + length * 10) { return(Color.White); } if (mouseY < lm.Position.Y * 100 + 50 - length * 10 || mouseY > lm.Position.Y * 100 + 50 + length * 10) { return(Color.White); } } else if (Type == RegionType.Row) { if (mouseY / 100 != lm.Position.Y) { return(Color.White); } } else if (Type == RegionType.Column) { if (mouseX < lm.Position.X + 50 - length * 5 || mouseX > lm.Position.X + 50 + length * 5) { return(Color.White); } } return(color); }
public void OnRoundEffect(LiveMonster src) { TimeLeft -= 0.025; RoundMark++; if (RoundMark % 100 == 50)//ÿ0.5»ØºÏ´¥·¢ { if (BuffConfig.OnRound != null) { BuffConfig.OnRound(src); } } }
public static HitDamage GetDamage(LiveMonster src, LiveMonster dest) { HitDamage damage; double attrRateOn = 1; //属性相克的伤害修正 bool isCrt = false; if (dest.Avatar.MonsterConfig.AttrDef != null) { attrRateOn -= dest.Avatar.MonsterConfig.AttrDef[src.AttackType]; } if (src.RealCrt > 0)//存在暴击率 { if (MathTool.GetRandom(100) < src.RealCrt * GameConstants.CrtToRate) { attrRateOn *= (GameConstants.DefaultCrtDamage + src.CrtDamAddRate); isCrt = true; } } var realAttackType = MonsterBook.HasTag(src.CardId, "mattack") ? src.Attr : src.AttackType; if (realAttackType == 0) //物理攻击 { var damValue = Math.Max(1, (int)(src.RealAtk * (1 - FormulaBook.GetPhyDefRate(dest.RealDef)) * attrRateOn)); //至少有1点伤害 var noDefDamValue = (int)(src.RealAtk * attrRateOn); damage = new HitDamage(damValue, noDefDamValue, 0, DamageTypes.Physical); } else { var damValue = (int)(src.RealAtk * (1 + src.RealMag * GameConstants.MagToRate) * (1 - FormulaBook.GetMagDefRate(dest.RealMag)) * attrRateOn); damage = new HitDamage(damValue, damValue, realAttackType, DamageTypes.Magic); dest.CheckMagicDamage(damage); } damage.IsCrt = isCrt; bool nodef = false; //无视防御 if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { src.SkillManager.CheckDamage(src, dest, true, damage, ref nodef); } if (!dest.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { dest.SkillManager.CheckDamage(src, dest, false, damage, ref nodef); } damage.SetDamage(DamageTypes.All, damage.Value); return(damage); }
public Color GetColor(LiveMonster lm, int mouseX, int mouseY) { if (Type == RegionType.None || Type == RegionType.Grid) return Color.White; if (color == Color.Red && !lm.GoLeft) return Color.White; if (color == Color.Green && lm.GoLeft) return Color.White; if (Type == RegionType.Circle) { if (HSMath.GetDistance(mouseX, mouseY, lm.Position.X + 50, lm.Position.Y * 100 + 50) > length * 10) return Color.White; } else if (Type == RegionType.Rect) { if (mouseX < lm.Position.X + 50 - length * 10 || mouseX > lm.Position.X + 50 + length * 10) return Color.White; if (mouseY < lm.Position.Y * 100 + 50 - length * 10 || mouseY > lm.Position.Y * 100 + 50 + length * 10) return Color.White; } else if (Type == RegionType.Row) { if (mouseY / 100 != lm.Position.Y) return Color.White; } else if (Type == RegionType.Column) { if (mouseX < lm.Position.X + 50 - length * 5 || mouseX > lm.Position.X + 50 + length * 5) return Color.White; } return color; }
private int GetMonsterRate(LiveMonster mon) { int score = 10000-mon.Hp; score += mon.RealRange*10;//优先打远程单位 if (MonsterBook.HasTag(mon.CardId, "taunt")) { score += 10000; } else if (MonsterBook.HasTag(mon.CardId, "hide")) { score -= 5000; } return score; }
private int lastTarget; //上一个攻击目标 public MonsterAi(LiveMonster mon) { monster = mon; }
private void CheckMove(LiveMonster nearestEnemy) { var moveDis = BattleManager.Instance.MemMap.CardSize; Point aimPos; //决定想去的目标点 bool goX; if (nearestEnemy.Position.X != monster.Position.X) { var x = monster.Position.X + (nearestEnemy.Position.X > monster.Position.X ? moveDis : -moveDis); aimPos = new Point(x, monster.Position.Y); goX = true; } else { var y = monster.Position.Y + (nearestEnemy.Position.Y > monster.Position.Y ? moveDis : -moveDis); aimPos = new Point(monster.Position.X, y); goX = false; } if (!BattleLocationManager.IsPlaceCanMove(aimPos.X, aimPos.Y)) { if (goX)//绕过不可行走区域 aimPos = BattleLocationManager.GetMonsterNearPoint(monster.Position, "side", !monster.IsLeft); else//往前走 aimPos= BattleLocationManager.GetMonsterNearPoint(monster.Position, "come", !monster.IsLeft); } if (aimPos.X >=0&& aimPos.Y >=0) { BattleLocationManager.SetToPosition(monster, aimPos); } if (monster.ReadMov > 10) //会返回一些ats { monster.AddActionRate((float) (monster.ReadMov - 10)/monster.ReadMov); } monster.MovRound++; }
/// <summary> /// 判定hit技能影响 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="rhit">命中</param> public void CheckHit(LiveMonster src, LiveMonster dest, ref int rhit) { foreach (MemBaseSkill skill in Skills.ToArray()) { var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id); if (skill.IsBurst(key)) { skill.CheckHit(src, dest, ref rhit, key); } } }
/// <summary> /// 判定技能释放状态 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="isMelee">是否是近战攻击(否则远程)</param> public void CheckBurst(LiveMonster src, LiveMonster dest, bool isMelee) { foreach (MemBaseSkill skill in Skills.ToArray()) { if (InForget && skill.Type != SkillSourceTypes.Weapon) continue; skill.CheckBurst(src, dest, isMelee); } }
private List<ActiveEffect> coverEffectList = new List<ActiveEffect>();//变身时需要重算 public MonsterCoverBox(LiveMonster liveMonster) { this.liveMonster = liveMonster; CheckCover(); }
public bool InForget { get; set; }//处于遗忘状态,遗忘除了武器外的技能 public SkillManager(LiveMonster lm) { Skills = new List<MemBaseSkill>(); self = lm; }
/// <summary> /// 判定伤害后技能影响 /// </summary> /// <param name="src">攻击者</param> /// <param name="dest">受击者</param> /// <param name="damage">伤害值</param> public void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage damage) { foreach (MemBaseSkill skill in Skills.ToArray()) { var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id); if (skill.IsBurst(key)) { skill.CheckHitEffectAfter(src, dest, damage, key); } } }
public BuffManager(LiveMonster liveMonster) { self = liveMonster; }
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; }
private bool CanAttack(LiveMonster target) { var dis = MathTool.GetDistance(target.Position, monster.Position); return dis <= monster.RealRange * BattleManager.Instance.MemMap.CardSize/10;//射程也是十倍的 }