private void Repulsion(UserMagic magic) { bool result = false; for (int d = 0; d <= 1; d++) { for (int y = CurrentLocation.Y - d; y <= CurrentLocation.Y + d; y++) { if (y < 0) continue; if (y >= CurrentMap.Height) break; for (int x = CurrentLocation.X - d; x <= CurrentLocation.X + d; x += Math.Abs(y - CurrentLocation.Y) == d ? 1 : d * 2) { if (x < 0) continue; if (x >= CurrentMap.Width) break; Cell cell = CurrentMap.GetCell(x, y); if (!cell.Valid || cell.Objects == null) continue; for (int i = 0; cell.Objects != null && i < cell.Objects.Count; i++) { MapObject ob = cell.Objects[i]; if (ob.Race != ObjectType.Monster && ob.Race != ObjectType.Player) continue; if (!ob.IsAttackTarget(this) || ob.Level >= Level) continue; if (Envir.Random.Next(20) >= 6 + magic.Level * 3 + Level - ob.Level) continue; int distance = 1 + Math.Max(0, magic.Level - 1) + Envir.Random.Next(2); MirDirection dir = Functions.DirectionFromPoint(CurrentLocation, ob.CurrentLocation); if (ob.Pushed(this, dir, distance) == 0) continue; if (ob.Race == ObjectType.Player) ob.Attacked(this, magic.GetDamage(0), DefenceType.None, false); result = true; } } } } if (result) LevelMagic(magic); }
private void ExplosiveTrap(UserMagic magic, Point location) { int trapCount = 0; for (int i = 0; i <= 3; i++) if (ArcherTrapObjectsArray[i, 0] != null) trapCount++; if (trapCount >= magic.Level + 1) return;//max 4 traps int freeTrapSpot = -1; for (int i = 0; i <= 3; i++) if (ArcherTrapObjectsArray[i, 0] == null) { freeTrapSpot = i; break; } if (freeTrapSpot == -1) return; int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location, freeTrapSpot); CurrentMap.ActionList.Add(action); }
public void NapalmShot(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return; int distance = Functions.MaxDistance(CurrentLocation, target.CurrentLocation); int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); damage = ApplyArcherState(damage); int delay = distance * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, damage, target.CurrentLocation); CurrentMap.ActionList.Add(action); }
private void CrescentSlash(UserMagic magic) { int damageBase = GetAttackPower(MinDC, MaxDC); if (Envir.Random.Next(0, 100) <= Accuracy) damageBase += damageBase;//crit should do something like double dmg, not double max dc dmg! int damageFinal = magic.GetDamage(damageBase); MirDirection backDir = Functions.ReverseDirection(Direction); MirDirection preBackDir = Functions.PreviousDir(backDir); MirDirection nextBackDir = Functions.NextDir(backDir); for (int i = 0; i < 8; i++) { MirDirection dir = (MirDirection)i; Point hitPoint = Functions.PointMove(CurrentLocation, dir, 1); if (dir != backDir && dir != preBackDir && dir != nextBackDir) { if (!CurrentMap.ValidPoint(hitPoint)) continue; Cell cell = CurrentMap.GetCell(hitPoint); if (cell.Objects == null) continue; for (int j = 0; j < cell.Objects.Count; j++) { MapObject target = cell.Objects[j]; switch (target.Race) { case ObjectType.Monster: case ObjectType.Player: //Only targets if (target.IsAttackTarget(this)) { DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + AttackSpeed, target, damageFinal, DefenceType.AC, true); ActionList.Add(action); } break; } } LevelMagic(magic); } } }
private bool DoubleShot(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return false; if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return false; int distance = Functions.MaxDistance(CurrentLocation, target.CurrentLocation); int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); damage = (int)(damage * Math.Max(1, (distance * 0.25)));//range boost damage = ApplyArcherState(damage); int delay = distance * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target); ActionList.Add(action); action = new DelayedAction(DelayedType.Magic, Envir.Time + delay + 50, magic, damage, target); ActionList.Add(action); return true; }
private void SlashingBurst(UserMagic magic, out bool cast) { cast = true; // damage int damageBase = GetAttackPower(MinDC, MaxDC); int damageFinal = magic.GetDamage(damageBase); // objects = this, magic, damage, currentlocation, direction, attackRange DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damageFinal, CurrentLocation, Direction, 1); CurrentMap.ActionList.Add(action); // telpo location Point location = Functions.PointMove(CurrentLocation, Direction, 2); if (!CurrentMap.ValidPoint(location)) return; Cell cInfo = CurrentMap.GetCell(location); bool blocked = false; if (cInfo.Objects != null) { for (int c = 0; c < cInfo.Objects.Count; c++) { MapObject ob = cInfo.Objects[c]; if (!ob.Blocking) continue; blocked = true; if ((cInfo.Objects == null) || blocked) break; } } // blocked telpo cancel if (blocked) return; Teleport(CurrentMap, location, false); //// move character //CurrentMap.GetCell(CurrentLocation).Remove(this); //RemoveObjects(Direction, 1); //CurrentLocation = location; //CurrentMap.GetCell(CurrentLocation).Add(this); //AddObjects(Direction, 1); //Enqueue(new S.UserAttackMove { Direction = Direction, Location = location }); }
private void HeavenlySword(UserMagic magic) { int damage = magic.GetDamage(GetAttackPower(MinDC, MaxDC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction); CurrentMap.ActionList.Add(action); }
private void MeteorStrike(UserMagic magic, Point location, out bool cast) { cast = false; int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location); ActiveBlizzard = true; CurrentMap.ActionList.Add(action); cast = true; }
private void IceThrust(UserMagic magic) { int damageBase = GetAttackPower(MinMC, MaxMC); if (Envir.Random.Next(100) <= (1 + Luck)) damageBase += damageBase; int damageFinish = magic.GetDamage(damageBase); Point location = Functions.PointMove(CurrentLocation, Direction, 1); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 1500, this, magic, location, Direction, damageFinish, (int)(damageFinish * 0.6)); CurrentMap.ActionList.Add(action); }
private void FlameDisruptor(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); if (!target.Undead) damage = (int)(damage * 1.5F); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target); ActionList.Add(action); }
private void ThunderStorm(UserMagic magic) { int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation); CurrentMap.ActionList.Add(action); }
private void FireWall(UserMagic magic, Point location) { int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location); CurrentMap.ActionList.Add(action); }
private void Vampirism(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target); ActionList.Add(action); }
private void HellFire(UserMagic magic) { int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction, 4); CurrentMap.ActionList.Add(action); if (magic.Level != 3) return; MirDirection dir = (MirDirection)(((int)Direction + 1) % 8); action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, dir, 4); CurrentMap.ActionList.Add(action); dir = (MirDirection)(((int)Direction - 1 + 8) % 8); action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, dir, 4); CurrentMap.ActionList.Add(action); }
private void BladeAvalanche(UserMagic magic) { int damageBase = GetAttackPower(MinDC, MaxDC); if (Envir.Random.Next(0,100) <= (1+Luck)) damageBase += damageBase;//crit should do something like double dmg, not double max dc dmg! int damageFinal = magic.GetDamage(damageBase); int col = 3; int row = 3; Point[] loc = new Point[col]; //0 = left 1 = center 2 = right loc[0] = Functions.PointMove(CurrentLocation, Functions.PreviousDir(Direction), 1); loc[1] = Functions.PointMove(CurrentLocation, Direction, 1); loc[2] = Functions.PointMove(CurrentLocation, Functions.NextDir(Direction), 1); for (int i = 0; i < col; i++) { Point startPoint = loc[i]; for (int j = 0; j < row; j++) { Point hitPoint = Functions.PointMove(startPoint, Direction, j); if (!CurrentMap.ValidPoint(hitPoint)) continue; Cell cell = CurrentMap.GetCell(hitPoint); if (cell.Objects == null) continue; for (int k = 0; k < cell.Objects.Count; k++) { MapObject target = cell.Objects[k]; switch (target.Race) { case ObjectType.Monster: case ObjectType.Player: //Only targets if (target.IsAttackTarget(this)) { if (target.Attacked(this, j <= 1 ? damageFinal : (int)(damageFinal * 0.6), DefenceType.MAC, false) > 0) LevelMagic(magic); } break; } } } } }
private void Healing(MapObject target, UserMagic magic) { if (target == null || !target.IsFriendlyTarget(this)) return; int health = magic.GetDamage(GetAttackPower(MinSC, MaxSC) * 2) + Level; DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, health, target); ActionList.Add(action); }
private void ShoulderDash(UserMagic magic) { if (InTrapRock) return; if (!CanWalk) return; ActionTime = Envir.Time + MoveDelay; int dist = Envir.Random.Next(2) + magic.Level + 2; int travel = 0; bool wall = true; Point location = CurrentLocation; MapObject target = null; for (int i = 0; i < dist; i++) { location = Functions.PointMove(location, Direction, 1); if (!CurrentMap.ValidPoint(location)) break; Cell cell = CurrentMap.GetCell(location); bool blocking = false; if (cell.Objects != null) { for (int c = cell.Objects.Count - 1; c >= 0; c--) { MapObject ob = cell.Objects[c]; if (!ob.Blocking) continue; wall = false; if (ob.Race != ObjectType.Monster && ob.Race != ObjectType.Player) { blocking = true; break; } if (target == null && ob.Race == ObjectType.Player) target = ob; if (Envir.Random.Next(20) >= 6 + magic.Level * 3 + Level - ob.Level || !ob.IsAttackTarget(this) || ob.Level >= Level || ob.Pushed(this, Direction, 1) == 0) { if (target == ob) target = null; blocking = true; break; } if (cell.Objects == null) break; } } if (blocking) { if (magic.Level != 3) break; Point location2 = Functions.PointMove(location, Direction, 1); if (!CurrentMap.ValidPoint(location2)) break; cell = CurrentMap.GetCell(location2); blocking = false; if (cell.Objects != null) { for (int c = cell.Objects.Count - 1; c >= 0; c--) { MapObject ob = cell.Objects[c]; if (!ob.Blocking) continue; if (ob.Race != ObjectType.Monster && ob.Race != ObjectType.Player) { blocking = true; break; } if (!ob.IsAttackTarget(this) || ob.Level >= Level || ob.Pushed(this, Direction, 1) == 0) { blocking = true; break; } if (cell.Objects == null) break; } } if (blocking) break; cell = CurrentMap.GetCell(location); if (cell.Objects != null) { for (int c = cell.Objects.Count - 1; c >= 0; c--) { MapObject ob = cell.Objects[c]; if (!ob.Blocking) continue; if (ob.Race != ObjectType.Monster && ob.Race != ObjectType.Player) { blocking = true; break; } if (Envir.Random.Next(20) >= 6 + magic.Level * 3 + Level - ob.Level || !ob.IsAttackTarget(this) || ob.Level >= Level || ob.Pushed(this, Direction, 1) == 0) { blocking = true; break; } if (cell.Objects == null) break; } } if (blocking) break; } travel++; CurrentMap.GetCell(CurrentLocation).Remove(this); RemoveObjects(Direction, 1); CurrentLocation = location; Enqueue(new S.UserDash { Direction = Direction, Location = location }); Broadcast(new S.ObjectDash { ObjectID = ObjectID, Direction = Direction, Location = location }); CurrentMap.GetCell(CurrentLocation).Add(this); AddObjects(Direction, 1); } if (travel > 0 && !wall) { if (target != null) target.Attacked(this, magic.GetDamage(0), DefenceType.None, false); LevelMagic(magic); } if (travel > 0) { ActionTime = Envir.Time + (travel * MoveDelay); Cell cell = CurrentMap.GetCell(CurrentLocation); for (int i = 0; i < cell.Objects.Count; i++) { if (cell.Objects[i].Race != ObjectType.Spell) continue; SpellObject ob = (SpellObject)cell.Objects[i]; if (ob.Spell != Spell.FireWall || !IsAttackTarget(ob.Caster)) continue; Attacked(ob.Caster, ob.Value, DefenceType.MAC, false); break; } } if (travel == 0 || wall && dist != travel) { if (travel > 0) { Enqueue(new S.UserDash { Direction = Direction, Location = Front }); Broadcast(new S.ObjectDash { ObjectID = ObjectID, Direction = Direction, Location = Front }); SafeZoneInfo szi = CurrentMap.GetSafeZone(CurrentLocation); if (szi != null) { BindLocation = szi.Location; BindMapIndex = CurrentMapIndex; InSafeZone = true; } else InSafeZone = false; } else Broadcast(new S.ObjectDash { ObjectID = ObjectID, Direction = Direction, Location = Front }); Enqueue(new S.UserDashFail { Direction = Direction, Location = CurrentLocation }); Broadcast(new S.ObjectDashFail { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); ReceiveChat("Not enough pushing Power.", ChatType.System); } magic.CastTime = Envir.Time; _stepCounter = 0; //ActionTime = Envir.Time + GetDelayTime(MoveDelay); Enqueue(new S.MagicCast { Spell = magic.Spell }); CellTime = Envir.Time + 500; }
private bool Poisoning(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return false; UserItem item = GetPoison(1); if (item == null) return false; int power = magic.GetDamage(GetAttackPower(MinSC, MaxSC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, power, target, item); ActionList.Add(action); ConsumeItem(item, 1); return true; }
private void CounterAttackCast(UserMagic magic, MapObject target) { if (target == null || magic == null) return; if (CounterAttack == false) return; int damageBase = GetAttackPower(MinDC, MaxDC); if (Envir.Random.Next(0, 100) <= Accuracy) damageBase += damageBase;//crit should do something like double dmg, not double max dc dmg! int damageFinal = magic.GetDamage(damageBase); MirDirection dir = Functions.ReverseDirection(target.Direction); Direction = dir; if (Functions.InRange(CurrentLocation, target.CurrentLocation, 1) == false) return; if (Envir.Random.Next(10) > magic.Level + 6) return; Enqueue(new S.ObjectMagic { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Spell = Spell.CounterAttack, TargetID = target.ObjectID, Target = target.CurrentLocation, Cast = true, Level = GetMagic(Spell.CounterAttack).Level, SelfBroadcast = true }); DelayedAction action = new DelayedAction(DelayedType.Damage, AttackTime, target, damageFinal, DefenceType.AC, true); ActionList.Add(action); LevelMagic(magic); CounterAttack = false; }
private bool SoulFireball(MapObject target, UserMagic magic, out bool cast) { cast = false; UserItem item = GetAmulet(1); if (item == null) return false; cast = true; if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false; int damage = magic.GetDamage(GetAttackPower(MinSC, MaxSC)); int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target); ActionList.Add(action); ConsumeItem(item, 1); return true; }
private bool PoisonSword(UserMagic magic) { UserItem item = GetPoison(1); if (item == null) return false; Point hitPoint; Cell cell; MirDirection dir = Functions.PreviousDir(Direction); int power = magic.GetDamage(GetAttackPower(MinDC, MaxDC)); for (int i = 0; i < 5; i++) { hitPoint = Functions.PointMove(CurrentLocation, dir, 1); dir = Functions.NextDir(dir); if (!CurrentMap.ValidPoint(hitPoint)) continue; cell = CurrentMap.GetCell(hitPoint); if (cell.Objects == null) continue; for (int o = 0; o < cell.Objects.Count; o++) { MapObject target = cell.Objects[o]; if (target.Race != ObjectType.Player && target.Race != ObjectType.Monster) continue; if (target == null || !target.IsAttackTarget(this) || target.Node == null) continue; target.ApplyPoison(new Poison { Duration = 3 + power / 10 + magic.Level * 3, Owner = this, PType = PoisonType.Green, TickSpeed = 1000, Value = power / 10 + magic.Level + 1 + Envir.Random.Next(PoisonAttack) }, this); target.OperateTime = 0; break; } } LevelMagic(magic); ConsumeItem(item, 1); return true; }
private void MassHealing(UserMagic magic, Point location) { int value = magic.GetDamage(GetAttackPower(MinSC, MaxSC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, value, location); CurrentMap.ActionList.Add(action); }
private void FlashDash(UserMagic magic) { bool success = false; ActionTime = Envir.Time; int travel = 0; bool blocked = false; int jumpDistance = (magic.Level <= 1) ? 0 : 1;//3 max Point location = CurrentLocation; for (int i = 0; i < jumpDistance; i++) { location = Functions.PointMove(location, Direction, 1); if (!CurrentMap.ValidPoint(location)) break; Cell cInfo = CurrentMap.GetCell(location); if (cInfo.Objects != null) { for (int c = 0; c < cInfo.Objects.Count; c++) { MapObject ob = cInfo.Objects[c]; if (!ob.Blocking) continue; blocked = true; if ((cInfo.Objects == null) || blocked) break; } } if (blocked) break; travel++; } jumpDistance = travel; if (jumpDistance > 0) { location = Functions.PointMove(CurrentLocation, Direction, jumpDistance); CurrentMap.GetCell(CurrentLocation).Remove(this); RemoveObjects(Direction, 1); CurrentLocation = location; CurrentMap.GetCell(CurrentLocation).Add(this); AddObjects(Direction, 1); Enqueue(new S.UserDashAttack { Direction = Direction, Location = location }); Broadcast(new S.ObjectDashAttack { ObjectID = ObjectID, Direction = Direction, Location = location, Distance = jumpDistance }); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); } if (travel == 0) location = CurrentLocation; int attackDelay = (AttackSpeed - 120) <= 300 ? 300 : (AttackSpeed - 120); AttackTime = Envir.Time + attackDelay; SpellTime = Envir.Time + 300; location = Functions.PointMove(location, Direction, 1); if (CurrentMap.ValidPoint(location)) { Cell cInfo = CurrentMap.GetCell(location); if (cInfo.Objects != null) { for (int c = 0; c < cInfo.Objects.Count; c++) { MapObject ob = cInfo.Objects[c]; switch (ob.Race) { case ObjectType.Monster: case ObjectType.Player: //Only targets if (ob.IsAttackTarget(this)) { DelayedAction action = new DelayedAction(DelayedType.Damage, AttackTime, ob,magic.GetDamage(GetAttackPower(MinDC, MaxDC)), DefenceType.AC, true); ActionList.Add(action); success = true; if ((((ob.Race != ObjectType.Player) || Settings.PvpCanResistPoison) && (Envir.Random.Next(Settings.PoisonAttackWeight) >= ob.PoisonResist)) && (Envir.Random.Next(15) <= magic.Level + 1)) { DelayedAction pa = new DelayedAction(DelayedType.Poison, AttackTime, ob, PoisonType.Stun, SpellEffect.TwinDrakeBlade, magic.Level + 1, 1000); ActionList.Add(pa); } } break; } } } } if (success) //technicaly this makes flashdash lvl when it casts rather then when it hits (it wont lvl if it's not hitting!) LevelMagic(magic); magic.CastTime = Envir.Time; Enqueue(new S.MagicCast { Spell = magic.Spell }); }
private void PoisonCloud(UserMagic magic, Point location, out bool cast) { cast = false; UserItem amulet = GetAmulet(5); if (amulet == null) return; UserItem poison = GetPoison(5, 1); if (poison == null) return; int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step int damage = magic.GetDamage(GetAttackPower(MinSC, MaxSC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, damage, location, (byte)Envir.Random.Next(PoisonAttack)); ConsumeItem(amulet, 5); ConsumeItem(poison, 5); CurrentMap.ActionList.Add(action); cast = true; }
private bool DelayedExplosion(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false; int power = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, power, target); ActionList.Add(action); return true; }
private void Plague(UserMagic magic, Point location, out bool cast) { cast = false; UserItem item = GetAmulet(1); if (item == null) return; cast = true; int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step PoisonType pType = PoisonType.None; UserItem itemp = GetPoison(1, 1); if (itemp != null) pType = PoisonType.Green; else { itemp = GetPoison(1, 2); if (itemp != null) pType = PoisonType.Red; } DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, magic.GetDamage(GetAttackPower(MinSC, MaxSC)), location, pType); CurrentMap.ActionList.Add(action); ConsumeItem(item, 1); if (itemp != null) ConsumeItem(itemp, 1); }
public void SpecialArrowShot(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return; int distance = Functions.MaxDistance(CurrentLocation, target.CurrentLocation); int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); if (magic.Spell != Spell.CrippleShot) damage = (int)(damage * Math.Max(1, (distance * 0.4)));//range boost damage = ApplyArcherState(damage); int delay = distance * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target); ActionList.Add(action); }
private void Curse(UserMagic magic, Point location, out bool cast) { cast = false; UserItem item = GetAmulet(1); if (item == null) return; cast = true; ConsumeItem(item, 1); if (Envir.Random.Next(10 - ((magic.Level + 1) * 2)) > 2) return; int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, magic.GetDamage(GetAttackPower(MinSC, MaxSC)), location, 1 + ((magic.Level + 1) * 2)); CurrentMap.ActionList.Add(action); }
public void OneWithNature(MapObject target, UserMagic magic) { int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation); CurrentMap.ActionList.Add(action); }
private bool Fireball(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false; int damage = magic.GetDamage(GetAttackPower(MinMC, MaxMC)); int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target); //if(magic.Info.Spell == Spell.GreatFireBall && magic.Level >= 3 && target.Race == ObjectType.Monster) //{ // List<MapObject> targets = ((MonsterObject)target).FindAllNearby(3, target.CurrentLocation); // int secondaryTargetCount = targets.Count > 3 ? 3 : targets.Count; // for (int i = 0; i < secondaryTargetCount; i++) // { // if (!target.IsAttackTarget(this)) continue; // DelayedAction action2 = new DelayedAction(DelayedType.Magic, Envir.Time + delay + 200, magic, damage / 2, targets[i]); // ActionList.Add(action2); // Enqueue(new S.Magic { Spell = magic.Info.Spell, TargetID = targets[i].ObjectID, Target = targets[i].CurrentLocation, Cast = true, Level = magic.Level }); // Broadcast(new S.ObjectMagic { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Spell = magic.Info.Spell, TargetID = targets[i].ObjectID, Target = targets[i].CurrentLocation, Cast = true, Level = magic.Level }); // } //} ActionList.Add(action); return true; }