private void EnergyShield(MapObject target, UserMagic magic, out bool cast) { cast = false; if (!target.IsFriendlyTarget(this)) target = this; //offical is only party target int duration = 30 + 50 * magic.Level; int power = GetAttackPower(magic.GetPower(MinSC), magic.GetPower(MaxSC) + 1); int chance = 9 - (Luck / 3 + magic.Level); int[] values = { chance < 2 ? 2 : chance, power }; switch (target.Race) { case ObjectType.Player: //Only targets if (target.IsFriendlyTarget(this)) { target.AddBuff(new Buff { Type = BuffType.EnergyShield, Caster = this, ExpireTime = Envir.Time + duration * 1000, Visible = true, Values = values }); target.OperateTime = 0; LevelMagic(magic); cast = true; } break; } }
private void PoisonField(UserMagic magic, Point location, out bool cast) { cast = false; if(Envir.Time < PoisonFieldTime) return; UserItem amuelt = GetAmulet(5); if (amuelt == null) return; UserItem poison = GetPoison(5, 1); if (poison == null) return; int damage = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location, Envir.Random.Next(PoisonAttack)); ConsumeItem(amuelt, 5); ConsumeItem(poison, 5); PoisonFieldTime = Envir.Time + (18 - magic.Level*2)*1000; CurrentMap.ActionList.Add(action); cast = true; }
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 = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); 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 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 = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); 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 = (GetAttackPower(MinMC, MaxMC) + magic.GetPower()); 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 HeavenlySword(UserMagic magic) { int damage = GetAttackPower(MinDC, MaxDC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction); CurrentMap.ActionList.Add(action); }
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 = (GetAttackPower(MinMC, MaxMC) + magic.GetPower()); 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 FlameDisruptor(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); 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 = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation); CurrentMap.ActionList.Add(action); }
private void Vampirism(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this)) return; int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target); ActionList.Add(action); }
private void FireWall(UserMagic magic, Point location) { int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location); CurrentMap.ActionList.Add(action); }
private void HellFire(UserMagic magic) { int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); 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 bool Fireball(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false; int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); 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; }
private bool ElementalShot(MapObject target, UserMagic magic) { if (HasElemental) { if (target == null || !target.IsAttackTarget(this)) return false; if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return false; int orbPower = magic.GetPower() + GetElementalOrbPower(false);//base power + orbpower int damage = GetAttackPower(MinMC, MaxMC) + orbPower; 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); } else { ObtainElement(true);//gather orb through casting LevelMagic(magic); return false; } return true; }
private void PetEnhancer(MapObject target, UserMagic magic, out bool cast) { cast = false; if (target == null || target.Race != ObjectType.Monster || !target.IsFriendlyTarget(this)) return; int duration = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); cast = true; DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, duration, target); ActionList.Add(action); }
private void MeteorStrike(UserMagic magic, Point location, out bool cast) { cast = false; int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location); ActiveBlizzard = true; CurrentMap.ActionList.Add(action); cast = true; }
private void SlashingBurst(UserMagic magic, out bool cast) { cast = true; // damage int damage = GetAttackPower(MaxDC, MaxDC) * magic.GetPower(); // objects = this, magic, damage, currentlocation, direction, attackRange DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, 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 Healing(MapObject target, UserMagic magic) { if (target == null || !target.IsFriendlyTarget(this)) return; int health = GetAttackPower(MinSC, MaxSC) * 2 + magic.GetPower() + Level; DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, health, target); ActionList.Add(action); }
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 = GetAttackPower(MinDC, MaxDC) + magic.GetPower(); 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 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 = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); 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 DelayedExplosion(MapObject target, UserMagic magic) { if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false; int power = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); 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 MassHealing(UserMagic magic, Point location) { int value = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, value, location); CurrentMap.ActionList.Add(action); }
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 = (GetAttackPower(MinMC, MaxMC) + magic.GetPower()); 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 Revelation(MapObject target, UserMagic magic) { if (target == null) return; int value = GetAttackPower(MinSC, MaxSC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, value, target); ActionList.Add(action); }
public void OneWithNature(MapObject target, UserMagic magic) { int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation); CurrentMap.ActionList.Add(action); }
private void BladeAvalanche(UserMagic magic) { int damage = GetAttackPower(MinDC, MaxDC) + magic.GetPower(); DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction, 3); CurrentMap.ActionList.Add(action); Point location = Functions.PointMove(CurrentLocation, MirDirection.Right, 1); action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location, Direction, 3); CurrentMap.ActionList.Add(action); location = Functions.PointMove(CurrentLocation, MirDirection.Left, 1); action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, location, Direction, 3); CurrentMap.ActionList.Add(action); }