public TrueWeapon(LiveMonster lm, int level, Weapon wpn) { self = lm; avatar = wpn; Level = level; Life = wpn.Dura; }
public void InitUnit(Player player) { int x = player.IsLeft ? 0 : ColumnCount - 1; int y = RowCount / 2; foreach (var unitInfo in bMap.Info) { var id = World.WorldInfoManager.GetCardFakeId(); var heroData = new Monster(unitInfo.UnitId); var level = ConfigData.GetLevelExpConfig(player.Level).TowerLevel; LiveMonster lm = new LiveMonster(id, level, heroData, new Point((x + (player.IsLeft ? unitInfo.X : (-unitInfo.X))) * CardSize, (y + unitInfo.Y) * CardSize), player.IsLeft); BattleManager.Instance.MonsterQueue.Add(lm); } if (player.InitialMonster != null && player.InitialMonster.Length >= 3) { for (int i = 0; i < player.InitialMonster.Length; i+=3) { int mid = player.InitialMonster[i]; int xoff = player.InitialMonster[i+1]; int yoff = player.InitialMonster[i+2]; var id = World.WorldInfoManager.GetCardFakeId(); var level = ConfigData.GetLevelExpConfig(player.Level).TowerLevel; var mon = new Monster(mid); mon.UpgradeToLevel(level); var pos = new Point((x + xoff)*CardSize, yoff*CardSize); LiveMonster lm = new LiveMonster(id, level, mon, pos, player.IsLeft); BattleManager.Instance.MonsterQueue.Add(lm); } } }
public MonsterAuro(LiveMonster mon, int buff, int lv, string tar) { self = mon; buffId = buff; level = lv; target = tar; }
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 void CheckMonsterEvent(bool isAdd, LiveMonster mon) { if (isAdd) { if (mon.IsHero) { if (atkAddon > 0) { mon.Atk.Source += atkAddon; } if (hpAddon > 0) { mon.MaxHp.Source += hpAddon; mon.AddHp(hpAddon);//顺便把hp也加上 } } //if (Avatar.MonsterConfig.Type != (int)CardTypeSub.Hero) // EAddonBook.UpdateMonsterData(this, OwnerPlayer.State.Monsterskills.Keys(), OwnerPlayer.State.Monsterskills.Values()); MonsterTypeCounts[(int) MonsterCountTypes.Total]++; MonsterTypeCounts[mon.Attr + 10]++; MonsterTypeCounts[mon.Type + 20]++; } else { MonsterTypeCounts[(int)MonsterCountTypes.Total]--; MonsterTypeCounts[mon.Attr + 10]--; MonsterTypeCounts[mon.Type + 20]--; } }
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); }
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.BattleInfo.Round = 0; LiveMonster newMon = new LiveMonster(World.WorldInfoManager.GetCardFakeId(), 1, new Monster(left), new Point(3 * size, 2 * size), true); //if (leftWeapon > 0) //{ // newMon.AddWeapon(leftWeapon, 1, 0); //} LiveMonster newMon2 = new LiveMonster(World.WorldInfoManager.GetCardFakeId(), 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 bool BeHited(LiveMonster src) { int hitrate = SkillAssistant.GetHit(src, this); if (hitrate > MathTool.GetRandom(100)) { HitDamage damage = SkillAssistant.GetDamage(src, this); CheckDamageBuffEffect(src, damage); HpBar.OnDamage(damage); SkillAssistant.CheckHitEffectAfter(src, this, damage); if (src.WeaponId > 0) { src.Weapon.OnHit(); } if (WeaponId > 0) { Weapon.OnHited(); } if (damage.Value > 0) { BuffManager.CheckRecoverOnHit(); lastDamagerId = src.Id; peakDamagerLuk = Math.Max(peakDamagerLuk, src.RealLuk); } return(true); } return(false); }
public void OnAddBuff(LiveMonster src) { if (BuffConfig.OnAdd!=null) { BuffConfig.OnAdd(src); } }
public ActiveEffect(Effect effect, Point p, bool isMute) : base(effect, isMute) { this.mon = null; this.point = p; frameId = -1; }
public void OnRemoveBuff(LiveMonster src) { if (BuffConfig.OnRemove != null) { BuffConfig.OnRemove(src); } }
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 HitTarget(LiveMonster target, bool isMelee) { if (target != null) { SkillAssistant.CheckBurst(this, target, isMelee); bool isMiss = !target.BeHited(this); if (isMiss) { BattleManager.Instance.FlowWordQueue.Add(new FlowWord("Miss!", new Point(Position.X + 40, Position.Y + 40), 0, "red", -10, 0), false); } } }
public void OnRoundEffect(LiveMonster src) { TimeLeft -= 0.025; RoundMark++; if (RoundMark%100==50)//ÿ0.5»ØºÏ´¥·¢ { if (BuffConfig.OnRound != null) { BuffConfig.OnRound(src); } } }
public static int GetHit(LiveMonster src, LiveMonster dest) { int rhit = GameConstants.DefaultHitRate + (src.RealHit - dest.RealDHit)*GameConstants.HitToRate; if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { src.SkillManager.CheckHit(src, dest, ref rhit); } if (!dest.BuffManager.HasBuff(BuffEffectTypes.NoSkill)) { dest.SkillManager.CheckHit(src, dest, ref rhit); } return Math.Max(rhit, 0); }
internal Color GetColor(LiveMonster lm, int mouseX, int mouseY) { if (color == Color.Red && lm.IsLeft) return Color.White; if (color == Color.Green && !lm.IsLeft) return Color.White; if (!BattleLocationManager.IsPointInRegionType(Type, mouseX, mouseY, lm.Position, range, true)) //magicregion永远为leftplayer服务 { return Color.White; } return color; }
public void Add(LiveMonster mon) { mon.OwnerPlayer.State.CheckMonsterEvent(true, mon); monsters.Add(mon); BattleLocationManager.UpdateCellOwner(mon.Position.X, mon.Position.Y, mon.Id); mon.OnInit(); if (mon.IsLeft) { LeftCount++; } else { RightCount++; } }
private void CheckDamageBuffEffect(LiveMonster src, HitDamage dam) { if (dam.Dtype == DamageTypes.Physical) { if (BuffManager.HasBuff(BuffEffectTypes.Chaos) && MathTool.GetRandom(100) < 25) { src.HpBar.OnDamage(dam); dam.SetDamage(DamageTypes.Physical, 0); } } if (BuffManager.HasBuff(BuffEffectTypes.Shield)) { dam.SetDamage(DamageTypes.All, 1); } }
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*(100-dest.RealDef*GameConstants.DefToRate)/100f * attrRateOn));//至少有1点伤害 var noDefDamValue = (int)(src.RealAtk * attrRateOn); damage = new HitDamage(damValue, noDefDamValue, 0, DamageTypes.Physical); } else { var damValue = (int)(src.RealAtk * (100 + src.RealMag * GameConstants.MagToRate) / 100f * 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 static void SetToPosition(LiveMonster lm, Point dest) { MemMapPoint point = BattleManager.Instance.MemMap.GetMouseCell(dest.X, dest.Y); if (!point.CanMove) //todo 暂时不考虑飞行单位 { return; } if (point.Owner != 0) { return; } ClearCellOwner(lm.Position.X, lm.Position.Y); lm.Position = new Point(point.X, point.Y); UpdateCellOwner(point.X, point.Y, lm.Id); }
public void CheckWeaponEffect(LiveMonster src, int symbol) { src.Atk += avatar.Atk * GameConstants.SideKickFactor * symbol; src.MaxHp += avatar.Hp * GameConstants.SideKickFactor * symbol; if (symbol > 0 && avatar.Hp > 0)//加buff时候 { src.AddHp(avatar.Hp);//顺便把hp也加上 } src.Def += avatar.Def * symbol; src.Mag += avatar.Mag * symbol; src.Hit += avatar.Hit * symbol; src.Dhit += avatar.Dhit * symbol; src.Crt += avatar.Crt * symbol; src.Spd += avatar.Spd * symbol; src.Luk += avatar.Luk * symbol; }
public static void UpdateMonsterData(LiveMonster mon, int[] skillid, int[] skillvalue) { for (int i = 0; i < skillid.Length; i++) { switch (skillid[i]) { case 101: mon.Atk += skillvalue[i]; break; //case 102: mon.Def += skillvalue[i]; break; //case 103: mon.Mag += skillvalue[i]; break; //case 104: mon.Hit += skillvalue[i]; break; //case 105: mon.DHit += skillvalue[i]; break; case 106: mon.MaxHp += skillvalue[i]; break; case 107: mon.HpReg += skillvalue[i]; break; // case 108: mon.MagicRatePlus += skillvalue[i]; break; // case 109: mon.TileEffectPlus += skillvalue[i]; break; case 111: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Water) mon.AddStrengthLevel(skillvalue[i]); break; case 112: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Wind) mon.AddStrengthLevel(skillvalue[i]); break; case 113: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Fire) mon.AddStrengthLevel(skillvalue[i]); break; case 114: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Earth) mon.AddStrengthLevel(skillvalue[i]); break; case 115: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Light) mon.AddStrengthLevel(skillvalue[i]); break; case 116: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.Dark) mon.AddStrengthLevel(skillvalue[i]); break; case 119: if (mon.Avatar.MonsterConfig.Attr == (int)CardElements.None) mon.AddStrengthLevel(skillvalue[i]); break; case 120: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Goblin) mon.AddStrengthLevel(skillvalue[i]); break; case 121: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Devil) mon.AddStrengthLevel(skillvalue[i]); break; case 122: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Machine) mon.AddStrengthLevel(skillvalue[i]); break; case 123: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Spirit) mon.AddStrengthLevel(skillvalue[i]); break; case 124: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Insect) mon.AddStrengthLevel(skillvalue[i]); break; case 125: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Dragon) mon.AddStrengthLevel(skillvalue[i]); break; case 126: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Bird) mon.AddStrengthLevel(skillvalue[i]); break; case 127: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Crawling) mon.AddStrengthLevel(skillvalue[i]); break; case 128: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Human) mon.AddStrengthLevel(skillvalue[i]); break; case 129: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Orc) mon.AddStrengthLevel(skillvalue[i]); break; case 130: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Undead) mon.AddStrengthLevel(skillvalue[i]); break; case 131: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Beast) mon.AddStrengthLevel(skillvalue[i]); break; case 132: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Fish) mon.AddStrengthLevel(skillvalue[i]); break; case 133: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Element) mon.AddStrengthLevel(skillvalue[i]); break; case 134: if (mon.Avatar.MonsterConfig.Type == (int)CardTypeSub.Plant) mon.AddStrengthLevel(skillvalue[i]); break; case 201: mon.SkillManager.RemoveSkill(233); break; //case 202: if (mon.Avatar.MonsterConfig.Star < 3) mon.SkillManager.AddSkill(SkillConfig.Indexer.FightQuick, 1, 100, SkillSourceTypes.Equip); break; //case 302: mon.Def *= (double)skillvalue[i] / 100; break; //case 304: mon.Spd *= (double)skillvalue[i] / 100; break; //case 305: mon.Hit *= (double)skillvalue[i] / 100; break; //case 306: mon.DHit *= (double)skillvalue[i] / 100; break; } } }
public void Summon(string type, int id, int count) { if (IsSummoned) {//召唤生物不能继续召唤,防止无限循环 return; } List <Point> posLis = MonsterPositionHelper.GetAvailPointList(Position, type, IsLeft, count); foreach (var pos in posLis) { var mon = new Monster(id); mon.UpgradeToLevel(Level); LiveMonster newMon = new LiveMonster(Level, mon, pos, IsLeft); newMon.IsSummoned = true; BattleManager.Instance.MonsterQueue.AddDelay(newMon); } }
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 CheckWeaponEffect(LiveMonster src, int symbol) { WeaponConfig weaponConfig = ConfigData.GetWeaponConfig(CardId); src.Atk += avatar.Atk * symbol; src.MaxHp += avatar.Hp * symbol; if (symbol > 0 && avatar.Hp > 0)//加buff时候 { src.AddHp(avatar.Hp);//顺便把hp也加上 } src.Def += avatar.Def * symbol; src.Mag += avatar.Mag * symbol; src.Hit += avatar.Hit * symbol; src.Dhit += avatar.Dhit * symbol; src.Crt += avatar.Crt * symbol; src.Spd += avatar.Spd * symbol; src.Luk += avatar.Luk * symbol; if (weaponConfig.Type == (int)CardTypeSub.Scroll) { if (symbol == 1) { src.AttackType = weaponConfig.Attr; } else { src.AttackType = (int)CardElements.None; } } if (weaponConfig.SkillId != 0) { if (symbol == 1) { src.SkillManager.AddSkill(weaponConfig.SkillId, Level, weaponConfig.Percent, SkillSourceTypes.Weapon); } else { src.SkillManager.RemoveSkill(weaponConfig.SkillId); } } }
public void CheckBurst(LiveMonster src, LiveMonster dest, bool isMelee) { var isActive = src == Self; if (isActive && SkillInfo.SkillConfig.Active == SkillActiveType.Passive) { return; } if (!isActive && SkillInfo.SkillConfig.Active == SkillActiveType.Active) { return; } BurstStage isBurst = CheckRate() ? BurstStage.Pass : BurstStage.Fail; if (SkillInfo.SkillConfig.CanBurst != null && !SkillInfo.SkillConfig.CanBurst(src, dest, isMelee)) { isBurst = BurstStage.Fail; } int key = GetBurstKey(src.Id, dest.Id); burst[key] = isBurst; }
private void CheckDamageBuffEffect(LiveMonster src, HitDamage dam) { if (dam.Dtype == DamageTypes.Physical) { if (BuffManager.HasBuff(BuffEffectTypes.Chaos) && MathTool.GetRandom(100) < 25) { src.Life -= dam.Value; dam.SetDamage(DamageTypes.Physical, 0); } } if (BuffManager.HasBuff(BuffEffectTypes.Shield)) { dam.SetDamage(DamageTypes.All, 1); } }
public void Summon(int type, int id) { if (IsSummoned) {//召唤生物不能继续召唤,防止无限循环 return; } List<Point> posLis = new List<Point>(); if (type == 1)//上下各一个 { int size = BattleManager.Instance.MemMap.CardSize; posLis.Add(new Point(Position.X, Position.Y - size)); posLis.Add(new Point(Position.X, Position.Y + size)); } else if (type == 2)//4格随机位置 { posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "around", IsLeft)); } else if (type == 3)//后面 { posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "come", IsLeft)); } else if (type == 4)//前面 { posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "back", IsLeft)); } else if (type == 5)//4格位置 { int size = BattleManager.Instance.MemMap.CardSize; posLis.Add(new Point(Position.X, Position.Y - size)); posLis.Add(new Point(Position.X, Position.Y + size)); posLis.Add(new Point(Position.X - size, Position.Y)); posLis.Add(new Point(Position.X + size, Position.Y)); } foreach (var pos in posLis) { if (BattleManager.Instance.MemMap.IsMousePositionCanSummon(pos.X, pos.Y)) { var mon = new Monster(id); mon.UpgradeToLevel(Level); LiveMonster newMon = new LiveMonster(World.WorldInfoManager.GetCardFakeId(), Level, mon, pos, IsLeft); newMon.IsSummoned = true; BattleManager.Instance.MonsterQueue.AddDelay(newMon); } } }
public bool BeHited(LiveMonster src) { int hitrate = SkillAssistant.GetHit(src, this); if (hitrate > MathTool.GetRandom(100)) { HitDamage damage = SkillAssistant.GetDamage(src, this); CheckDamageBuffEffect(src, damage); Life -= damage.Value; OnDamage(damage); SkillAssistant.CheckHitEffectAfter(src, this, damage); if (src.WeaponId > 0) { src.Weapon.OnHit(); } if (WeaponId > 0) { Weapon.OnHited(); } if (damage.Value > 0) { BuffManager.CheckRecoverOnHit(); lastDamagerId = src.Id; peakDamagerLuk = Math.Max(peakDamagerLuk, src.RealLuk); } return true; } return false; }
public void HitTarget(LiveMonster target, bool isMelee) { if (target != null) { SkillAssistant.CheckBurst(this, target, isMelee); bool isMiss = !target.BeHited(this); if (isMiss) BattleManager.Instance.FlowWordQueue.Add(new FlowWord("Miss!", new Point(Position.X + 40, Position.Y + 40), 0, "red", -10, 0), false); } }
public LiveMonsterToolTip(LiveMonster liveMonster) { this.liveMonster = liveMonster; }
private void CheckTrapOnSummon(LiveMonster mon, Player left, Player right) { foreach (var trap in trapList) { var effect = ConfigData.GetSpellTrapConfig(trap.Id).EffectSummon; if (effect != null) { if (MathTool.GetRandom(100) < trap.Rate && effect(left, right, trap, mon, trap.Level)) { RemoveTrap(trap.Id); NLog.Debug(string.Format("RemoveTrap Summon id={0} cardId={1}", trap.Id, mon.Id)); return; } } } }
public LandMissileControler(LiveMonster self, Point pos) { parent = self; targetPos = pos; }
private LiveMonster target;//目标 public TraceMissileControler(LiveMonster self, LiveMonster mon) { parent = self; target = mon; }
private LiveMonster target;//目标 public SpellTraceMissileControler(LiveMonster mon, ISpell spl) { spell = spl; target = mon; }