public override void SetAction(ObjectAction action) { base.SetAction(action); switch (CurrentAction) { case MirAction.Attack: switch (MagicType) { #region Sweet Brier and Karma (Karma should have different attack will do later if can be bothered) case MagicType.SweetBrier: case MagicType.Karma: if (LibraryWeaponShape >= 1200) { Effects.Add(new MirEffect(300, 6, TimeSpan.FromMilliseconds(100), LibraryFile.MagicEx4, 20, 70, Globals.NoneColour) //Element style? { Blend = true, Target = this, DrawColour = Globals.NoneColour, Direction = Direction, }); } else if (LibraryWeaponShape >= 1100) { Effects.Add(new MirEffect(100, 6, TimeSpan.FromMilliseconds(100), LibraryFile.MagicEx4, 20, 70, Globals.NoneColour) //Element style? { Blend = true, Target = this, DrawColour = Globals.NoneColour, Direction = Direction, }); } if (Gender == MirGender.Male) { DXSoundManager.Play(SoundIndex.SweetBrierMale); } else { DXSoundManager.Play(SoundIndex.SweetBrierFemale); } break; #endregion } break; } }
public override void SetAnimation(ObjectAction action) { MirAnimation animation; DrawWeapon = true; MagicType type; switch (action.Action) { case MirAction.Standing: //if(VisibleBuffs.Contains(BuffType.Stealth)) animation = MirAnimation.Standing; if (CEnvir.Now < StanceTime) { animation = MirAnimation.Stance; } if (VisibleBuffs.Contains(BuffType.Cloak)) { animation = MirAnimation.CreepStanding; } if (Horse != HorseType.None) { animation = MirAnimation.HorseStanding; } if (VisibleBuffs.Contains(BuffType.DragonRepulse)) { animation = MirAnimation.DragonRepulseMiddle; } else if (CurrentAnimation == MirAnimation.DragonRepulseMiddle) { animation = MirAnimation.DragonRepulseEnd; } break; case MirAction.Moving: //if(VisibleBuffs.Contains(BuffType.Stealth)) animation = MirAnimation.Walking; if (Horse != HorseType.None) { animation = MirAnimation.HorseWalking; } if ((MagicType)action.Extra[1] == MagicType.ShoulderDash || (MagicType)action.Extra[1] == MagicType.Assault) { animation = MirAnimation.Combat8; } else if (VisibleBuffs.Contains(BuffType.Cloak)) { animation = VisibleBuffs.Contains(BuffType.GhostWalk) ? MirAnimation.CreepWalkFast : MirAnimation.CreepWalkSlow; } else if ((int)action.Extra[0] >= 2) { animation = MirAnimation.Running; if (Horse != HorseType.None) { animation = MirAnimation.HorseRunning; } } break; case MirAction.Pushed: animation = MirAnimation.Pushed; break; case MirAction.Attack: type = (MagicType)action.Extra[1]; animation = Functions.GetAttackAnimation(Class, LibraryWeaponShape, type); break; case MirAction.Mining: animation = Functions.GetAttackAnimation(Class, LibraryWeaponShape, MagicType.None); break; case MirAction.RangeAttack: animation = MirAnimation.Combat1; break; case MirAction.Spell: type = (MagicType)action.Extra[0]; animation = Functions.GetMagicAnimation(type); if (type == MagicType.PoisonousCloud) { DrawWeapon = false; } break; // case MirAction.Struck: // animation = MirAnimation.Struck; // if (Horse != HorseType.None) // animation = MirAnimation.HorseStruck; //break; case MirAction.Die: animation = MirAnimation.Die; break; case MirAction.Dead: animation = MirAnimation.Dead; break; case MirAction.Harvest: animation = MirAnimation.Harvest; break; default: throw new ArgumentOutOfRangeException(); } CurrentAnimation = animation; if (!Frames.TryGetValue(CurrentAnimation, out CurrentFrame)) { CurrentFrame = Frame.EmptyFrame; } }
public sealed override void SetFrame(ObjectAction action) { base.SetFrame(action); switch (action.Action) { case MirAction.Spell: case MirAction.Attack: StanceTime = CEnvir.Now.AddSeconds(3); break; } switch (Class) { case MirClass.Assassin: switch (CurrentAnimation) { case MirAnimation.Standing: ArmourShift = 0; break; case MirAnimation.Walking: ArmourShift = 1600; break; case MirAnimation.Running: ArmourShift = 1600; break; case MirAnimation.CreepStanding: ArmourShift = 240; break; case MirAnimation.CreepWalkSlow: case MirAnimation.CreepWalkFast: ArmourShift = 240; break; case MirAnimation.Pushed: ArmourShift = 160; //pushed 2 = 160 break; case MirAnimation.Combat1: ArmourShift = -400; break; case MirAnimation.Combat2: ; // throw new NotImplementedException(); break; case MirAnimation.Combat3: ArmourShift = 0; break; case MirAnimation.Combat4: ArmourShift = 80; break; case MirAnimation.Combat5: ArmourShift = 400; break; case MirAnimation.Combat6: ArmourShift = 400; break; case MirAnimation.Combat7: ArmourShift = 400; break; case MirAnimation.Combat8: ArmourShift = 720; break; case MirAnimation.Combat9: ArmourShift = -960; break; case MirAnimation.Combat10: ArmourShift = -480; break; case MirAnimation.Combat11: ArmourShift = -400; break; case MirAnimation.Combat12: ArmourShift = -400; break; case MirAnimation.Combat13: ArmourShift = -400; break; case MirAnimation.Combat14: case MirAnimation.DragonRepulseStart: case MirAnimation.DragonRepulseMiddle: case MirAnimation.DragonRepulseEnd: ArmourShift = 0; break; case MirAnimation.Harvest: ArmourShift = 160; break; case MirAnimation.Stance: ArmourShift = 160; break; case MirAnimation.Struck: ArmourShift = -640; break; case MirAnimation.Die: ArmourShift = -400; break; case MirAnimation.Dead: ArmourShift = -400; break; case MirAnimation.HorseStanding: ArmourShift = 80; break; case MirAnimation.HorseWalking: ArmourShift = 80; break; case MirAnimation.HorseRunning: ArmourShift = 80; break; case MirAnimation.HorseStruck: ArmourShift = 80; break; default: throw new ArgumentOutOfRangeException(); } break; } }
public void AttemptAction(ObjectAction action) { if (CEnvir.Now < NextActionTime || ActionQueue.Count > 0) { return; } if (CEnvir.Now < ServerTime) { return; //Next Server response Time. } switch (action.Action) { case MirAction.Moving: if (CEnvir.Now < MoveTime) { return; } break; case MirAction.Attack: action.Extra[2] = Functions.GetElement(Stats); if (GameScene.Game.Equipment[(int)EquipmentSlot.Amulet]?.Info.ItemType == ItemType.DarkStone) { foreach (KeyValuePair <Stat, int> stats in GameScene.Game.Equipment[(int)EquipmentSlot.Amulet].Info.Stats.Values) { switch (stats.Key) { case Stat.FireAffinity: action.Extra[2] = Element.Fire; break; case Stat.IceAffinity: action.Extra[2] = Element.Ice; break; case Stat.LightningAffinity: action.Extra[2] = Element.Lightning; break; case Stat.WindAffinity: action.Extra[2] = Element.Wind; break; case Stat.HolyAffinity: action.Extra[2] = Element.Holy; break; case Stat.DarkAffinity: action.Extra[2] = Element.Dark; break; case Stat.PhantomAffinity: action.Extra[2] = Element.Phantom; break; } } } MagicType attackMagic = MagicType.None; if (AttackMagic != MagicType.None) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != AttackMagic) { continue; } if (CEnvir.Now < pair.Value.NextCast) { break; } if (AttackMagic == MagicType.Karma) { if (Stats[Stat.Health] * pair.Value.Cost / 100 > CurrentHP || Buffs.All(x => x.Type != BuffType.Cloak)) { break; } } else if (pair.Value.Cost > CurrentMP) { break; } attackMagic = AttackMagic; break; } } if (CanPowerAttack && TargetObject != null) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.Slaying) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanThrusting && GameScene.Game.MapControl.CanEnergyBlast(action.Direction)) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.Thrusting) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanHalfMoon && (TargetObject != null || (GameScene.Game.MapControl.CanHalfMoon(action.Direction) && (GameScene.Game.MapControl.HasTarget(Functions.Move(CurrentLocation, action.Direction)) || attackMagic != MagicType.Thrusting)))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.HalfMoon) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanDestructiveBlow && (TargetObject != null || (GameScene.Game.MapControl.CanDestructiveBlow(action.Direction) && (GameScene.Game.MapControl.HasTarget(Functions.Move(CurrentLocation, action.Direction)) || attackMagic != MagicType.Thrusting)))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.DestructiveSurge) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (attackMagic == MagicType.None && CanFlameSplash && (TargetObject != null || GameScene.Game.MapControl.CanDestructiveBlow(action.Direction))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.FlameSplash) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanBladeStorm) { attackMagic = MagicType.BladeStorm; } else if (CanDragonRise) { attackMagic = MagicType.DragonRise; } else if (CanFlamingSword) { attackMagic = MagicType.FlamingSword; } action.Extra[1] = attackMagic; break; case MirAction.Mount: return; } SetAction(action); int attackDelay; switch (action.Action) { case MirAction.Standing: NextActionTime = CEnvir.Now + Globals.TurnTime; CEnvir.Enqueue(new C.Turn { Direction = action.Direction }); if ((GameScene.Game.MapControl.MapButtons & MouseButtons.Right) != MouseButtons.Right) { GameScene.Game.CanRun = false; } break; case MirAction.Harvest: NextActionTime = CEnvir.Now + Globals.HarvestTime; CEnvir.Enqueue(new C.Harvest { Direction = action.Direction }); GameScene.Game.CanRun = false; break; case MirAction.Moving: MoveTime = CEnvir.Now + Globals.MoveTime; CEnvir.Enqueue(new C.Move { Direction = action.Direction, Distance = MoveDistance }); GameScene.Game.CanRun = true; break; case MirAction.Attack: attackDelay = Globals.AttackDelay - Stats[Stat.AttackSpeed] * Globals.ASpeedRate; attackDelay = Math.Max(800, attackDelay); AttackTime = CEnvir.Now + TimeSpan.FromMilliseconds(attackDelay); if (BagWeight > Stats[Stat.BagWeight]) { AttackTime += TimeSpan.FromMilliseconds(attackDelay); } CEnvir.Enqueue(new C.Attack { Direction = action.Direction, Action = action.Action, AttackMagic = MagicType }); GameScene.Game.CanRun = false; break; case MirAction.Spell: NextMagicTime = CEnvir.Now + Globals.MagicDelay; if (BagWeight > Stats[Stat.BagWeight]) { NextMagicTime += Globals.MagicDelay; } CEnvir.Enqueue(new C.Magic { Direction = action.Direction, Action = action.Action, Type = MagicType, Target = AttackTargets?.Count > 0 ? AttackTargets[0].ObjectID : 0, Location = MagicLocations?.Count > 0 ? MagicLocations[0] : Point.Empty }); GameScene.Game.CanRun = false; break; case MirAction.Mining: attackDelay = Globals.AttackDelay - Stats[Stat.AttackSpeed] * Globals.ASpeedRate; attackDelay = Math.Max(800, attackDelay); AttackTime = CEnvir.Now + TimeSpan.FromMilliseconds(attackDelay); if (BagWeight > Stats[Stat.BagWeight]) { AttackTime += TimeSpan.FromMilliseconds(attackDelay); } CEnvir.Enqueue(new C.Mining { Direction = action.Direction }); GameScene.Game.CanRun = false; break; default: GameScene.Game.CanRun = false; break; } ServerTime = CEnvir.Now.AddSeconds(5); }