public static void OutputEnum(Effects.Property enumProperty, Formatter output) { OutputVersionConditional(enumProperty.WinVer, output); output.WriteLine("[version(VERSION)]"); output.WriteLine("typedef enum " + enumProperty.TypeNameIdl); output.WriteLine("{"); output.Indent(); for (int i = 0; i < enumProperty.EnumFields.FieldsList.Count; ++i) { var enumValue = enumProperty.EnumFields.FieldsList[i]; if (i != (enumProperty.EnumFields.FieldsList.Count - 1)) { output.WriteLine(enumValue.Name + " = " + i.ToString() + ","); } else { output.WriteLine(enumValue.Name + " = " + i.ToString()); } } output.Unindent(); output.WriteLine("} " + enumProperty.TypeNameIdl + ";"); EndVersionConditional(enumProperty.WinVer, output); }
public void TransitionState(OnEndFadeIn FadeIn,OnEndFadeOut FadeOut,_TransitionType TT) { switch (TT) { case _TransitionType.FadeOut_In: CurrentEffectObj = Instantiate (EffectObj)as GameObject; CurrentEffectScript = CurrentEffectObj.GetComponentInChildren<Effects> (); CurrentEffectScript.EndFadeOutEvent += () => { FadeOut(); doFadeIn (); }; CurrentEffectScript.EndFadeInEvent += () => { FadeIn (); Destroy (CurrentEffectObj); }; doFadeOut (); break; case _TransitionType.No_Effect: FadeOut (); FadeIn (); break; } }
public void HandleTranslatedtoHiddenPosition(Effects.Effect effect) { Visible = false; if (OnHidden != null) { OnHidden (this); } }
public DialogueConversationNode(bool waitUserInteraction) { dialogue = new List<ConversationLine>(); nextNode = null; terminal = true; effects = new Effects(); this.keepShowing = waitUserInteraction; }
public TargetSpell(JSONObject js) : base(js) { Id = (int)js.GetField(js.keys[0]).n; AreaId = (int)js.GetField("areaId").n; EffectsArea = new Effects(js.GetField("effectsAreaIds")); EffectsAreaCrit = new Effects(js.GetField("effectsAreaCritIds")); _rangeId = (int)js.GetField("rangeId").n; }
// Use this for initialization void Start() { if (!player) player = GetComponent<Player> (); if(!rb) rb = GetComponent<Rigidbody>(); effects = Player.Effects; }
public SelfSpell(JSONObject js) : base(js) { Id = (int)js.GetField(js.keys[0]).n; AreaId = (int)js.GetField("areaId").n; EffectsArea = new Effects(js.GetField("effectsAreaIds")); EffectsAreaCrit = new Effects(js.GetField("effectsAreaCritIds")); _effects = new Effects(js.GetField("effectsIds")); _effectsCrit = new Effects(js.GetField("effectsCritIds")); }
public virtual void Awake() { //DefaultPosition = transform.position; //DefaultRotation = transform.rotation; Effects = new Effects(); _renderer = GetComponent<Renderer>(); if (_renderer == null) _renderer = GetComponentInChildren<Renderer>(); }
public SimplifierContext(bool inGlobalScope, bool keepFunctionNames, NameSupply nameSupply, Func<Expression, bool> isValue) { InGlobalScope = inGlobalScope; KeepFunctionNames = keepFunctionNames; NameSupply = nameSupply; subst = new Map<Identifier, Expression>(); statements = null; contextEffects = Effects.Bottom; this.isValue = isValue; }
/** * Creates a new cutscene * * @param type * The type of the scene * @param id * The id of the scene */ protected Cutscene(GeneralSceneSceneType type, string id) : base(type, id) { effects = new Effects(); destinyX = int.MinValue; destinyY = int.MaxValue; transitionType = NextSceneEnumTransitionType.NO_TRANSITION; transitionTime = 0; next = GOBACK; }
public void AnimationExtention_should_serialize_property_opacity_animation() { Effects effect = new Effects(); effect.Container.Add(new PropertyAnimation(PropertyAnimationType.Opacity)); _writer.Setup(w => w.Write(It.IsAny<string>())).Verifiable(); _objectWriter.Start().Serialize("effects", effect); _writer.Verify(w => w.Write("effects:{list:[{name:'property',properties:['opacity']}],openDuration:200,closeDuration:200}")); }
public void AnimationExtention_should_serialize_slide_animation() { Effects effect = new Effects(); effect.Container.Add(new SlideAnimation()); _writer.Setup(w => w.Write(It.IsAny<string>())).Verifiable(); _objectWriter.Start().Serialize("effects", effect); _writer.Verify(w => w.Write("effects:{list:[{name:'slide'}],openDuration:200,closeDuration:200}")); }
void Start () { int whatPower = Random.Range(0, itensNumber); switch (whatPower) { case 0: effect = Effects.SpeedPlus; this.GetComponent<SpriteRenderer>().sprite = powersSprites[0]; break; case 1: effect = Effects.SpeedMinus; this.GetComponent<SpriteRenderer>().sprite = powersSprites[1]; break; case 2: effect = Effects.AmmoPlus; this.GetComponent<SpriteRenderer>().sprite = powersSprites[2]; break; case 3: effect = Effects.AmmoMinus; this.GetComponent<SpriteRenderer>().sprite = powersSprites[3]; break; } }
/** * Creates a new NextScene * * @param nextSceneId * the id of the next scene */ public NextScene(string nextSceneId) { this.nextSceneId = nextSceneId; destinyX = int.MinValue; destinyY = int.MinValue; conditions = new Conditions(); effects = new Effects(); postEffects = new Effects(); transitionType = NextSceneEnumTransitionType.NO_TRANSITION; transitionTime = 0; }
public static void Export(Effects effects) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = WYZTracker.Core.Properties.Resources.FXFilter; if (sfd.ShowDialog() == DialogResult.OK) { XmlSerializer formatter = new XmlSerializer(typeof(Effects)); Stream objFileStream = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write, FileShare.None); formatter.Serialize(objFileStream, effects); objFileStream.Close(); } }
public void FadeOut_FadeIn_Transition(OnEndFadeIn FadeIn,OnEndFadeOut Fadeout) { CurrentEffectObj = Instantiate (EffectObj)as GameObject; CurrentEffectScript = CurrentEffectObj.GetComponentInChildren<Effects> (); CurrentEffectScript.EndFadeOutEvent += () => { Fadeout (); doFadeIn (); }; CurrentEffectScript.EndFadeInEvent += () => { FadeIn (); Destroy (CurrentEffectObj); }; doFadeOut (); }
public Timer(long time, Conditions init, Conditions end, Effects effect, Effects postEffect) { this.seconds = time; this.initCond = init; this.endCond = end; this.effect = effect; this.postEffect = postEffect; usesEndCondition = true; runsInLoop = true; multipleStarts = true; showTime = false; displayName = "timer"; countDown = true; showWhenStopped = false; }
public EffectHolder(Effects effects) { this.effects = new List<EffectHolderNode> (); if (effects != null && effects.getEffects().Count>0) { EffectHolderNode e = null; List<Condition> conditions = new List<Condition>(); foreach (AbstractEffect effect in effects.getEffects()) { if (effect == null) { } this.effects.Add(new EffectHolderNode(effect)); } } }
protected SimplifierContext (bool inGlobalScope, bool keepFunctionNames, NameSupply nameSupply, Map<Identifier, Expression> subst, Seq<Statement> statements, Effects contextEffects, Func<Expression, bool> isValue) { InGlobalScope = inGlobalScope; KeepFunctionNames = keepFunctionNames; NameSupply = nameSupply; this.subst = subst; this.statements = statements; this.contextEffects = contextEffects; this.isValue = isValue; }
public void Play(Effects effect) { GameObject go = null; if (effect == Effects.Attack) go = GameObject.Instantiate(attack, transform.position, Quaternion.identity) as GameObject; else if (effect == Effects.AdditionalAttack) go = GameObject.Instantiate(attackAdditional, transform.position, Quaternion.identity) as GameObject; else if (effect == Effects.BotAttack) go = GameObject.Instantiate(botAttack, transform.position, Quaternion.identity) as GameObject; else if (effect == Effects.PotionUse) go = GameObject.Instantiate(potion, transform.position, Quaternion.identity) as GameObject; else if (effect == Effects.PowerUpUse) go = GameObject.Instantiate(powerUp, transform.position, Quaternion.identity) as GameObject; go.transform.parent = this.transform; go.transform.localPosition = Vector3.zero; }
/// <summary> /// Fill in a grid - used in terrain generation (for now) and anything that requires planar data /// </summary> /// <param name="width">Width in world units of grid</param> /// <param name="depth">Depth in world units of grid</param> /// <param name="m">Subdivisions in the x direction</param> /// <param name="n">Subdivisions in the z direction</param> /// <param name="verts">Output array of vertex positions</param> /// <param name="indices">Output array of index positions</param> public static void CreateGrid(float width, float depth, uint m, uint n, out Effects.BasicEffect.BasicEffectVertex[] verts, out uint[] indices) { var vertList = new List<Effects.BasicEffect.BasicEffectVertex>(); var indexList = new List<uint>(); var halfWidth = width * 0.5f; var halfDepth = depth * 0.5f; var dx = width / (n - 1); var dz = depth / (m - 1); var du = 1.0f / (n - 1); var dv = 1.0f / (m - 1); for (var i = 0; i < m; ++i) { var z = halfDepth - i * dz; for (var j = 0; j < n; ++j) { var x = -halfWidth + j * dx; //vertList.Add(new Vector3(x, 0.0f, z)); vertList.Add(new Effects.BasicEffect.BasicEffectVertex() { Pos = new Vector3(x, 0.0f, z), TexCoord = new Vector2(j * du, i * dv) }); } } for (var i = 0u; i < m - 1; ++i) { for (var j = 0u; j < n - 1; ++j) { indexList.Add(i * n + j); indexList.Add(i * n + j + 1); indexList.Add((i + 1) * n + j); indexList.Add((i + 1) * n + j); indexList.Add(i * n + j + 1); indexList.Add((i + 1) * n + j + 1); } } verts = vertList.ToArray(); indices = indexList.ToArray(); }
// Use this for initialization protected virtual void Start() { colisao = GetComponent<CapsuleCollider> (); script = GetComponent<PlayerInput> (); scriptCharacter = GetComponent<Character> (); sound = GetComponent<AudioSource> (); // Obtem as instancias dos componentes Unity; _rigidBody = GetComponent<Rigidbody>(); _animator = GetComponent<Animator>(); CharacterEffects = new Effects(); this.AttributeModifiers = new AttributeModifier[CONSTANTS.ATTRIBUTES.ATTRIBUTE_MODIFIERS_COUNT]; for (int i = 0; i < this.AttributeModifiers.Length; i++) { this.AttributeModifiers[i] = null; } }
// Use this for initialization void Awake() { if (!Effects && GetComponent<Effects> ()) Effects = GetComponent<Effects> (); else if (!Effects) Effects = (Effects) gameObject.AddComponent<Effects> (); EnemyGC2 = enemyGC2; DontDestroyOnLoad (gameObject); PlayerManager.Players.Add (this); Walk = GetComponent<Walk> (); Punch = GetComponent<Punch> (); Health = GetComponent<Health> (); Mana = GetComponent<Mana> (); TurnBody = TB; TurnHead = TH; EnemyLOS = enemyLOS; SpawnLOS = spawnLOS; walk = Walk; health = Health; punch = Punch; mana = Mana; }
public CallContext(IImSeq<Identifier> parameters, IImSeq<Expression> arguments, Func<Expression, bool> isValue) { var paramMap = new Map<Identifier, int>(); for (var i = 0; i < parameters.Count; i++) paramMap.Add(parameters[i], i); Parameters = paramMap; var argumentEffects = new Seq<Effects>(parameters.Count); SeenParameters = new Seq<bool>(parameters.Count); var allReadOnly = true; AllArgumentEffects = Effects.Bottom; foreach (var e in arguments) { var fxCtxt = new EffectsContext(isValue); e.AccumEffects(fxCtxt, null, null); argumentEffects.Add(fxCtxt.AccumEffects); AllArgumentEffects = AllArgumentEffects.Lub(fxCtxt.AccumEffects); if (!fxCtxt.AccumEffects.IsReadOnly) allReadOnly = false; SeenParameters.Add(false); } ArgumentEffects = argumentEffects; AllReadOnly = allReadOnly; IsOk = true; }
public void Target(IPoint3D p) { IPoint3D orig = p; Map map = Caster.Map; SpellHelper.GetSurfaceTop(ref p); Point3D from = Caster.Location; Point3D to = new Point3D(p); if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (Server.Misc.WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo)) { } else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (SpellHelper.CheckMulti(to, map)) { Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot. } else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null) { Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot. } else if (CheckSequence()) { SpellHelper.Turn(Caster, orig); Mobile m = Caster; m.Location = to; m.ProcessDelta(); if (m.Player) { Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); } else { m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); } m.PlaySound(0x1FE); IPooledEnumerable eable = m.GetItemsInRange(0); foreach (Item item in eable) { if (item is Server.Spells.Fifth.PoisonFieldSpell.InternalItem || item is Server.Spells.Fourth.FireFieldSpell.FireFieldItem) { item.OnMoveOver(m); } } eable.Free(); } FinishSequence(); }
public override void OnThink() { base.OnThink(); if (Combatant != null && !Frozen && !IsHindered() && !m_AbilityInProgress && !m_HealthIntervalAbilityInProgress) { if (m_HealthIntervalAbilityReady) { m_HealthIntervalAbilityReady = false; DamageIntervalTriggered(); return; } else if (DateTime.UtcNow >= m_NextAbilityAllowed) { switch (Utility.RandomMinMax(1, 4)) { case 1: if (DateTime.UtcNow >= m_NextFireBarrageAllowed) { FireBarrage(); return; } break; case 2: if (DateTime.UtcNow >= m_NextFlameMarkAllowed) { FlameMark(); return; } break; case 3: if (DateTime.UtcNow >= m_NextKnockbackAllowed && Utility.GetDistance(Location, Combatant.Location) <= AttackRange) { Knockback(); return; } break; case 4: if (DateTime.UtcNow >= m_NextMassiveBreathAllowed && Utility.GetDistance(Location, Combatant.Location) <= MassiveBreathRange) { MassiveBreath(); return; } break; } } } if (Utility.RandomDouble() < .01 && DateTime.UtcNow > m_NextAIChangeAllowed) { Effects.PlaySound(Location, Map, GetAngerSound()); switch (Utility.RandomMinMax(1, 5)) { case 1: PublicOverheadMessage(MessageType.Regular, 0, false, "*roars*"); DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 2: PublicOverheadMessage(MessageType.Regular, 0, false, "*bares fangs*"); DictCombatTargetingWeight[CombatTargetingWeight.Player] = 10; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 3: PublicOverheadMessage(MessageType.Regular, 0, false, "*growls*"); DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 10; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 4: PublicOverheadMessage(MessageType.Regular, 0, false, "*flicks tongue*"); DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 10; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 5: PublicOverheadMessage(MessageType.Regular, 0, false, "*snorts*"); DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 10; break; } m_NextAIChangeAllowed = DateTime.UtcNow + NextAIChangeDelay; } }
public void FlameMark() { if (!SpecialAbilities.Exists(this)) { return; } IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FlameMarkRange); int mobileCount = 0; foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } mobileCount++; } nearbyMobiles.Free(); nearbyMobiles = Map.GetMobilesInRange(Location, FlameMarkRange); List <Mobile> m_NearbyMobiles = new List <Mobile>(); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Combatant != null) { if (mobileCount > 1 && mobile == Combatant) { continue; } } m_NearbyMobiles.Add(mobile); } nearbyMobiles.Free(); if (m_NearbyMobiles.Count == 0) { return; } Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)]; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; double directionDelay = .25; double initialDelay = 2; double totalDelay = 1 + directionDelay + initialDelay; int maxRadius = 7; int radius = 3 + (int)(Math.Ceiling((double)maxRadius * m_SpawnPercent)); m_AbilityInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_NextFlameMarkAllowed = DateTime.UtcNow + NextFlameMarkDelay; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } m_AbilityInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_NextFlameMarkAllowed = DateTime.UtcNow + NextFlameMarkDelay; }); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); Direction = Utility.GetDirection(Location, targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (m_HealthIntervalAbilityInProgress) { return; } Animate(29, 22, 1, true, false, 0); PlaySound(GetAngerSound()); PublicOverheadMessage(MessageType.Regular, 0, false, "*points a mighty claw*"); TimedStatic flamemark = new TimedStatic(6571, initialDelay); flamemark.Hue = 2591; flamemark.Name = "flamemark"; flamemark.MoveToWorld(targetLocation, targetMap); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } int damage = DamageMin; int minRange = radius * -1; int maxRange = radius; int effectHue = 0; //2590; Effects.PlaySound(targetLocation, targetMap, 0x306); //0x1F3 //0x306 //0x309 for (int a = minRange; a < maxRange + 1; a++) { for (int b = minRange; b < maxRange + 1; b++) { Point3D newPoint = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z); SpellHelper.AdjustField(ref newPoint, targetMap, 12, false); int distance = Utility.GetDistance(targetLocation, newPoint); double effectChance = 1.0 - ((double)distance * .05); if (Utility.RandomDouble() > effectChance) { continue; } Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (Utility.RandomDouble() <= .15) { SingleFireField singleFireField = new SingleFireField(this, 0, 2, 30, 3, 5, false, false, true, -1, true); singleFireField.MoveToWorld(newPoint, targetMap); } Effects.PlaySound(newPoint, targetMap, Utility.RandomList(0x4F1, 0x5D8, 0x5DA, 0x580)); Effects.SendLocationParticles(EffectItem.Create(newPoint, targetMap, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, effectHue, 0, 5029, 0); IPooledEnumerable mobilesOnTile = targetMap.GetMobilesInRange(newPoint, 0); Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } mobilesOnTile.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); if (mobile is BaseCreature) { damage *= 3; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, damage, 100, 0, 0, 0, 0); } }); } } }); }); }
public void FireBreathSpin() { double maxRotations = 4; int rotations = (int)(Math.Ceiling(maxRotations * m_SpawnPercent)); double totalDelay = 1.5 + ((double)rotations * 1.5); Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_AbilityInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } m_AbilityInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = false; }); Effects.PlaySound(Location, Map, GetAngerSound()); SpecialAbilities.DoMassiveBreathAttack(this, Location, Direction, 5, true, BreathType.Fire, false); PublicOverheadMessage(MessageType.Regular, 0, false, "*takes a massive breath*"); for (int a = 0; a < rotations; a++) { Timer.DelayCall(TimeSpan.FromSeconds(1.5 + (a * 1.5)), delegate { if (!SpecialAbilities.Exists(this)) { return; } int newDirectionValue = (int)Direction; newDirectionValue += Utility.RandomList(-3, -4, -5, 3, 4, 5); if (newDirectionValue > 7) { newDirectionValue = 0 + (newDirectionValue - 8); } else if (newDirectionValue < 0) { newDirectionValue = 8 + newDirectionValue; } Direction nextDirection = (Direction)(newDirectionValue); SpecialAbilities.DoMassiveBreathAttack(this, Location, nextDirection, MassiveBreathRange, true, BreathType.Fire, false); }); } }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if (CheckSequence()) { SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; Mobile directTarget = p as Mobile; if (map != null) { bool feluccaRules = (map.Rules == MapRules.FeluccaRules); // You can target any living mobile directly, beneficial checks apply if (directTarget != null && Caster.CanBeBeneficial(directTarget, false)) { targets.Add(directTarget); } IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (m == directTarget) { continue; } if (AreaCanTarget(m, feluccaRules)) { targets.Add(m); } } eable.Free(); } Effects.PlaySound(p, Caster.Map, Sound); if (targets.Count > 0) { int cured = 0; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; Caster.DoBeneficial(m); Poison poison = m.Poison; if (poison != null) { int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Magery].Value * 75) - ((poison.Level + 1) * 1750); chanceToCure /= 100; if (m.CurePoison(Caster)) { ++cured; } } //m.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist ); m.PlaySound(Sound); } //if ( cured > 0 ) // Caster.SendLocalizedMessage( 1010058 ); // You have cured the target of all poisons! } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); if (p is Item) { p = ((Item)p).GetWorldLocation(); } var targets = AcquireIndirectTargets(p, 2).ToList(); var count = Math.Max(1, targets.Count); foreach (var dam in targets) { var id = dam; var m = id as Mobile; double damage; if (Core.AOS) { damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id); } else { damage = Utility.Random(27, 22); } if (Core.AOS && count > 2) { damage = (damage * 2) / count; } else if (!Core.AOS) { damage /= count; } if (!Core.AOS && m != null && CheckResisted(m)) { damage *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } Mobile source = Caster; SpellHelper.CheckReflect((int)Circle, ref source, ref id, SpellDamageType); if (m != null) { damage *= GetDamageScalar(m); } Effects.SendBoltEffect(id, true, 0, false); Caster.DoHarmful(id); SpellHelper.Damage(this, id, damage, 0, 0, 0, 0, 100); } ColUtility.Free(targets); } FinishSequence(); }
public Point MakeTurn(Map map, out Action doit) { Tile[,] tiles = map.tiles; Debug.Assert(actionsLeft > 0); reachableTiles = CalcReach(tilePosition, movementRange, false); skillReachable = CalcReach(tilePosition, skillRange + movementRange, true); if (currAmmo == 0) { //find tile with cover move to there doit = () => { currAmmo = maxAmmo; UsedSkill(); Debug.WriteLine(name + " is Reloading"); Map.damagePopup.Show(this, "Reloading"); }; return(tilePosition); } else { //Find attack or healing possibility, can not move List <Tuple <Actor, int> > targetPossibilities = new List <Tuple <Actor, int> >(12); foreach (Point p in skillReachable) { Actor a = tiles[p.X, p.Y].actorOnTop; if (a != null) { if (a.faction == Faction.Enemy) { if (a.HP == a.maxHP) { continue; } } int score = int.MaxValue; if (a.faction == Faction.Enemy) { score = (a.maxHP - a.HP) - GetCurrentHealing() / 2; if (score <= 0) { score = 0; } } else { score = a.HP - GetCurrentDamage(); if (score < 0) { score = 0; } } targetPossibilities.Add(new Tuple <Actor, int>(a, score)); } } if (targetPossibilities.Count == 0) { doit = () => { currAmmo = maxAmmo; UsedSkill(); Debug.WriteLine(name + " is Reloading and maybe random walking"); }; // just reload, maybe still move somewhere? foreach (Point p in map.IterateNeighboursFourDir(tilePosition)) { if (tiles[p.X, p.Y].IsWalkable() && map.random.NextDouble() <= 0.5) { return(p); } } return(tilePosition); } else { targetPossibilities.Sort((a, b) => a.Item2 - b.Item2); //is this right? the smaller number shall be sorted first. if a.item2 is smaller than b, than its negative number, tehrefore smaller? Actor target = targetPossibilities[0].Item1; if (target.faction == Faction.User) { doit = () => { map.Attack(this, target); }; } else { doit = () => { target.TakeDamage(-GetCurrentHealing()); Sounds.Play("healing"); Effects.ShowEffect("healing", target.realPosition); UsedSkill(); }; } skillReachable = CalcReach(tilePosition, skillRange, true); if (skillReachable.Contains(target.tilePosition)) { return(tilePosition); } else { Point pos = tilePosition; foreach (Point p in reachableTiles) { if (p != tilePosition && tiles[p.X, p.Y].IsWalkable() && (p - target.tilePosition).ToVector2().Length() <= skillRange) { pos = p; skillReachable = CalcReach(pos, skillRange, true); break; } } if (pos == tilePosition) { doit = () => { UsedSkill(); Map.damagePopup.Show(this, "Bug"); }; } return(pos); //here find a tile from where can attack } } } }
public Bullet(Vector2 location, Vector2 velocity, int power, Effects effects, int playerId) { if ((effects & Effects.Wide) != 0) { Vector2 corner = new Vector2(2, 2); this.shape = new SurfaceTower.Model.Shape.Rectangle(location - corner, location + corner); } else if ((effects & Effects.Disc) != 0) { this.shape = new Circle(5, location); } else { this.shape = new Circle(3, location); } this.velocity = velocity; this.power = power; this.effects = effects; this.playerId = playerId; if ((effects & Effects.DoublePower) != 0) { this.velocity *= 2; this.power *= 2; } }
public override void Rota() { // // Rotations // // 0: JotC, SoC, JoC (AP build) // 1: JotC, SoR, JoC (nightfall max proc chance) // 2: JotC, SoR, JoR (spelldmg build) // // All rotations cast max-rank Consecration when Vengeance is up, // otherwise cast rank 1 Consecration on cooldown. // // use a mana pot if we're low if (mpot.CanUse() && (MaxMana - Mana) >= ManaPotion.MAX) { mpot.Cast(); } /* This isn't ready yet, apparently * if (bom.CanUse() && (!Effects.Any(e => e is BlessingOfMightBuff) || ((BlessingOfMightBuff)Effects.Where(e => e is BlessingOfMightBuff).First()).RemainingTime() < GCD)) * { * bom.Cast(); * } */ if (cds != null) { foreach (Skill cd in cds.Keys) { if (cd.CanUse() && (Sim.FightLength - Sim.CurrentTime <= cds[cd] || Sim.FightLength - Sim.CurrentTime >= cd.BaseCD + cds[cd])) { cd.Cast(); } } } #if false // HoW is not currently part of AP Ret max DPS // Use HoW on CD if boss is under 20% if (Sim.Boss.LifePct < 0.2) { if (how.CanUse() && Mana >= how.Cost) { how.Cast(); } } #endif // If crusader is already on teh boss, seal up a damage seal if (Sim.Boss.Effects.ContainsKey(JudgementOfTheCrusaderDebuff.NAME)) { // Judge command or righteousness, if possible if ( Effects.ContainsKey(SealOfCommandBuff_Rank5.NAME) || Effects.ContainsKey(SealOfCommandBuff_Rank1.NAME) || (rota == 2 && Effects.ContainsKey(SealOfRighteousnessBuff.NAME)) ) { if (jdg.CanUse() && Mana >= jdg.Cost) { jdg.Cast(); } } else { // // SoC is not currently active // // // If using Nightfall, a different rotation is used: SoR, SoC, JoC // if (rota == 1) { // If judgement is available (or will be available in the next half second), seal up with Command if (jdg.RemainingCD() <= 0.5) { if (Mana >= soc5.Cost) { soc5.Cast(); } else if (Mana >= soc1.Cost) { soc1.Cast(); } } else { // Judgement isn't available, so ensure SoR is active if (!Effects.ContainsKey(SealOfRighteousnessBuff.NAME) && sor.CanUse() && Mana >= sor.Cost) { sor.Cast(); } } } else { // // Non-Nightfall rotation // // SoR rotation if (rota == 2) { // Turn on SoR if (sor.CanUse() && Mana >= sor.Cost) { sor.Cast(); } } else { // Otherwise, seal up command if (soc5.CanUse() && Mana >= soc5.Cost) { // Rank 5 if mana... soc5.Cast(); } else if (soc1.CanUse() && Mana >= soc1.Cost) { // Otherwise, Rank 1 soc1.Cast(); } } } } } else { // Otherwise, judge crusader if (Effects.ContainsKey(SealOfTheCrusaderBuff.NAME)) { if (jdg.CanUse() && Mana >= jdg.Cost) { jdg.Cast(); } } else { // Or apply the seal if (sotc.CanUse() && Mana >= sotc.Cost) { sotc.Cast(); } } } // Cast max-rank consecration if Vengeance is up if (GetTalentPoints("Consecration") > 0) { if (Effects.ContainsKey(Vengeance.NAME) && cons5.CanUse() && Mana >= cons5.Cost) { cons5.Cast(); // Trigger CD on other ranks cons1.CDAction(); } else if (cons1.CanUse() && Mana >= cons1.Cost) { cons1.Cast(); // Trigger CD on other ranks cons5.CDAction(); } } CheckAAs(); }
/** * @param notEffects * the notEffects to set */ public void setNotEffects(Effects notEffects) { this.notEffects = notEffects; }
public void Target(IPoint3D p) { if (!this.Caster.CanSee(p)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, this.Caster) && this.CheckSequence()) { SpellHelper.Turn(this.Caster, p); if (p is Item) { p = ((Item)p).GetWorldLocation(); } List <IDamageable> targets = new List <IDamageable>(); Map map = this.Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetObjectsInRange(new Point3D(p), 2); foreach (object o in eable) { IDamageable id = o as IDamageable; if (id == null || (Core.AOS && id is Mobile && (Mobile)id == this.Caster)) { continue; } if ((!(id is Mobile) || SpellHelper.ValidIndirectTarget(this.Caster, id as Mobile)) && this.Caster.CanBeHarmful(id, false)) { if (Core.AOS && !this.Caster.InLOS(id)) { continue; } targets.Add(id); } } eable.Free(); } double damage; if (targets.Count > 0) { Effects.PlaySound(p, this.Caster.Map, 0x160); for (int i = 0; i < targets.Count; ++i) { IDamageable id = targets[i]; Mobile m = id as Mobile; if (Core.AOS) { damage = this.GetNewAosDamage(51, 1, 5, id is PlayerMobile, id); } else { damage = Utility.Random(27, 22); } if (Core.AOS && targets.Count > 2) { damage = (damage * 2) / targets.Count; } else if (!Core.AOS) { damage /= targets.Count; } if (!Core.AOS && m != null && this.CheckResisted(m)) { damage *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } if (m != null) { damage *= this.GetDamageScalar(m); } this.Caster.DoHarmful(id); SpellHelper.Damage(this, id, damage, 0, 100, 0, 0, 0); this.Caster.MovingParticles(id, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100); } } targets.Clear(); targets.TrimExcess(); } this.FinishSequence(); }
protected override void PrepareEffects(Effects effects) { // add info to tooltip that this effect deals damage effects.AddValue(this, StatName.VanityContinuousDamage, 1); }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player m_From.SendMessage("Trying to manipulate the contraption resulted in a broken lockpick."); m_Lockpick.Consume(); return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! m_From.SendMessage("Woot! You succeed at picking the lock."); m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. // ==== Random Item Disintergration upon Failure ==== if ((Core.SA) && m_Item is TreasureMapChest) { int i_Num = 0; Item i_Destroy = null; BaseContainer m_chest = m_Item as BaseContainer; Item Dust = new DustPile(); for (int i = 10; i > 0; i--) { i_Num = Utility.Random(m_chest.Items.Count); // Make sure DustPiles aren't called for destruction if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile) { for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--) { i_Num = ci; if (i_Num < 0) { i_Num = 0; } if (m_chest.Items[i_Num] is DustPile) { i_Destroy = null; } else { i_Destroy = m_chest.Items[i_Num]; i_Num = i_Num; i = 0; } // Nothing left but Dust if (ci < 0 && i > 0) { i_Destroy = null; i = 0; } } } // Item targetted =+= prepare for object DOOM! >;D else { i_Destroy = m_chest.Items[i_Num]; i = 0; } } // Delete chosen Item and drop a Dust Pile if (i_Destroy is Gold) { if (i_Destroy.Amount > 1000) { i_Destroy.Amount -= 1000; } else { i_Destroy.Delete(); } Dust.Hue = 1177; m_chest.DropItem(Dust); } else if (i_Destroy != null) { i_Destroy.Delete(); m_chest.DropItem(Dust); } Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE); m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest."); } } }
public virtual void DoEffect(Point3D loc, Map map) { Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(loc, map, 0x225); }
protected override void OnTick() { if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime) { Terminate(); return; } if (m_LastMoveTime != m_From.LastMoveTime) { m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew. Terminate(); return; } int z = (m_Chest != null) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue; int height = 16; if (z > m_Location.Z) { height -= (z - m_Location.Z); } else { z = m_Location.Z; } if (!m_Map.CanFit(m_Location.X, m_Location.Y, z, height, true, true, false)) { m_From.SendLocalizedMessage(503024); // You stop digging because something is directly on top of the treasure chest. Terminate(); return; } m_Count++; m_From.RevealingAction(); m_From.Direction = m_From.GetDirectionTo(m_Location); if (m_Count > 1 && m_Dirt1 == null) { m_Dirt1 = new TreasureChestDirt(); m_Dirt1.MoveToWorld(m_Location, m_Map); m_Dirt2 = new TreasureChestDirt(); m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map); } if (m_Count == 5) { m_Dirt1.Turn1(); } else if (m_Count == 10) { m_Dirt1.Turn2(); m_Dirt2.Turn2(); } else if (m_Count > 10) { if (m_Chest == null) { m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true); m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map); } else { m_Chest.Z++; } Effects.PlaySound(m_Chest, m_Map, 0x33B); } if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Temporary = false; m_TreasureMap.Completed = true; m_TreasureMap.CompletedBy = m_From; int spawns; switch (m_TreasureMap.Level) { case 0: spawns = 3; break; case 1: spawns = 0; break; default: spawns = 4; break; } for (int i = 0; i < spawns; ++i) { BaseCreature bc = Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true); if (bc != null) { m_Chest.Guardians.Add(bc); } } } else { if (m_From.Body.IsHuman && !m_From.Mounted) { m_From.Animate(11, 5, 1, true, false, 0); } new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start(); } }
private static XmlElement buildEffectNode(IEffect effect, XmlDocument doc) { XmlElement effectElement = null; switch (effect.getType()) { case EffectType.ACTIVATE: ActivateEffect activateEffect = (ActivateEffect)effect; effectElement = doc.CreateElement("activate"); effectElement.SetAttribute("flag", activateEffect.getTargetId()); break; case EffectType.DEACTIVATE: DeactivateEffect deactivateEffect = (DeactivateEffect)effect; effectElement = doc.CreateElement("deactivate"); effectElement.SetAttribute("flag", deactivateEffect.getTargetId()); break; case EffectType.SET_VALUE: SetValueEffect setValueEffect = (SetValueEffect)effect; effectElement = doc.CreateElement("set-value"); effectElement.SetAttribute("var", setValueEffect.getTargetId()); effectElement.SetAttribute("value", setValueEffect.getValue().ToString()); break; case EffectType.INCREMENT_VAR: IncrementVarEffect incrementVarEffect = (IncrementVarEffect)effect; effectElement = doc.CreateElement("increment"); effectElement.SetAttribute("var", incrementVarEffect.getTargetId()); effectElement.SetAttribute("value", incrementVarEffect.getIncrement().ToString()); break; case EffectType.DECREMENT_VAR: DecrementVarEffect decrementVarEffect = (DecrementVarEffect)effect; effectElement = doc.CreateElement("decrement"); effectElement.SetAttribute("var", decrementVarEffect.getTargetId()); effectElement.SetAttribute("value", decrementVarEffect.getDecrement().ToString()); break; case EffectType.MACRO_REF: MacroReferenceEffect macroRefEffect = (MacroReferenceEffect)effect; effectElement = doc.CreateElement("macro-ref"); effectElement.SetAttribute("id", macroRefEffect.getTargetId()); break; case EffectType.CONSUME_OBJECT: ConsumeObjectEffect consumeObjectEffect = (ConsumeObjectEffect)effect; effectElement = doc.CreateElement("consume-object"); effectElement.SetAttribute("idTarget", consumeObjectEffect.getTargetId()); break; case EffectType.GENERATE_OBJECT: GenerateObjectEffect generateObjectEffect = (GenerateObjectEffect)effect; effectElement = doc.CreateElement("generate-object"); effectElement.SetAttribute("idTarget", generateObjectEffect.getTargetId()); break; case EffectType.CANCEL_ACTION: effectElement = doc.CreateElement("cancel-action"); break; case EffectType.SPEAK_PLAYER: SpeakPlayerEffect speakPlayerEffect = (SpeakPlayerEffect)effect; effectElement = doc.CreateElement("speak-player"); if (speakPlayerEffect.getAudioPath() != null && !speakPlayerEffect.getAudioPath().Equals("")) { effectElement.SetAttribute("uri", speakPlayerEffect.getAudioPath()); } effectElement.AppendChild(doc.CreateTextNode(speakPlayerEffect.getLine())); break; case EffectType.SPEAK_CHAR: SpeakCharEffect speakCharEffect = (SpeakCharEffect)effect; effectElement = doc.CreateElement("speak-char"); effectElement.SetAttribute("idTarget", speakCharEffect.getTargetId()); if (speakCharEffect.getAudioPath() != null && !speakCharEffect.getAudioPath().Equals("")) { effectElement.SetAttribute("uri", speakCharEffect.getAudioPath()); } effectElement.AppendChild(doc.CreateTextNode(speakCharEffect.getLine())); break; case EffectType.TRIGGER_BOOK: TriggerBookEffect triggerBookEffect = (TriggerBookEffect)effect; effectElement = doc.CreateElement("trigger-book"); effectElement.SetAttribute("idTarget", triggerBookEffect.getTargetId()); break; case EffectType.PLAY_SOUND: PlaySoundEffect playSoundEffect = (PlaySoundEffect)effect; effectElement = doc.CreateElement("play-sound"); if (!playSoundEffect.isBackground()) { effectElement.SetAttribute("background", "no"); } effectElement.SetAttribute("uri", playSoundEffect.getPath()); break; case EffectType.PLAY_ANIMATION: PlayAnimationEffect playAnimationEffect = (PlayAnimationEffect)effect; effectElement = doc.CreateElement("play-animation"); effectElement.SetAttribute("uri", playAnimationEffect.getPath()); effectElement.SetAttribute("x", playAnimationEffect.getX().ToString()); effectElement.SetAttribute("y", playAnimationEffect.getY().ToString()); break; case EffectType.MOVE_PLAYER: MovePlayerEffect movePlayerEffect = (MovePlayerEffect)effect; effectElement = doc.CreateElement("move-player"); effectElement.SetAttribute("x", movePlayerEffect.getX().ToString()); effectElement.SetAttribute("y", movePlayerEffect.getY().ToString()); break; case EffectType.MOVE_NPC: MoveNPCEffect moveNPCEffect = (MoveNPCEffect)effect; effectElement = doc.CreateElement("move-npc"); effectElement.SetAttribute("idTarget", moveNPCEffect.getTargetId()); effectElement.SetAttribute("x", moveNPCEffect.getX().ToString()); effectElement.SetAttribute("y", moveNPCEffect.getY().ToString()); break; case EffectType.TRIGGER_CONVERSATION: TriggerConversationEffect triggerConversationEffect = (TriggerConversationEffect)effect; effectElement = doc.CreateElement("trigger-conversation"); effectElement.SetAttribute("idTarget", triggerConversationEffect.getTargetId()); break; case EffectType.TRIGGER_CUTSCENE: TriggerCutsceneEffect triggerCutsceneEffect = (TriggerCutsceneEffect)effect; effectElement = doc.CreateElement("trigger-cutscene"); effectElement.SetAttribute("idTarget", triggerCutsceneEffect.getTargetId()); break; case EffectType.TRIGGER_LAST_SCENE: effectElement = doc.CreateElement("trigger-last-scene"); break; case EffectType.TRIGGER_SCENE: TriggerSceneEffect triggerSceneEffect = (TriggerSceneEffect)effect; effectElement = doc.CreateElement("trigger-scene"); effectElement.SetAttribute("idTarget", triggerSceneEffect.getTargetId()); effectElement.SetAttribute("x", triggerSceneEffect.getX().ToString()); effectElement.SetAttribute("y", triggerSceneEffect.getY().ToString()); effectElement.SetAttribute("transitionTime", triggerSceneEffect.getTransitionTime().ToString()); effectElement.SetAttribute("transitionType", ((int)triggerSceneEffect.getTransitionType()).ToString()); if (triggerSceneEffect.DestinyScale >= 0) { effectElement.SetAttribute("scale", triggerSceneEffect.DestinyScale.ToString(CultureInfo.InvariantCulture)); } break; case EffectType.WAIT_TIME: WaitTimeEffect waitTimeEffect = (WaitTimeEffect)effect; effectElement = doc.CreateElement("wait-time"); effectElement.SetAttribute("time", waitTimeEffect.getTime().ToString()); break; case EffectType.SHOW_TEXT: ShowTextEffect showTextEffect = (ShowTextEffect)effect; effectElement = doc.CreateElement("show-text"); effectElement.SetAttribute("x", showTextEffect.getX().ToString()); effectElement.SetAttribute("y", showTextEffect.getY().ToString()); effectElement.SetAttribute("frontColor", "#" + ColorUtility.ToHtmlStringRGBA(showTextEffect.getRgbFrontColor())); effectElement.SetAttribute("borderColor", "#" + ColorUtility.ToHtmlStringRGBA(showTextEffect.getRgbBorderColor())); effectElement.SetAttribute("uri", showTextEffect.getAudioPath()); effectElement.AppendChild(doc.CreateTextNode(showTextEffect.getText())); break; case EffectType.MOVE_OBJECT: MoveObjectEffect moveObjectEffect = (MoveObjectEffect)effect; effectElement = doc.CreateElement("move-object"); effectElement.SetAttribute("idTarget", moveObjectEffect.getTargetId()); effectElement.SetAttribute("x", moveObjectEffect.getX().ToString()); effectElement.SetAttribute("y", moveObjectEffect.getY().ToString()); effectElement.SetAttribute("scale", moveObjectEffect.getScale().ToString(CultureInfo.InvariantCulture)); effectElement.SetAttribute("animated", (moveObjectEffect.isAnimated() ? "yes" : "no")); effectElement.SetAttribute("translateSpeed", moveObjectEffect.getTranslateSpeed().ToString()); effectElement.SetAttribute("scaleSpeed", moveObjectEffect.getScaleSpeed().ToString()); break; case EffectType.HIGHLIGHT_ITEM: HighlightItemEffect highlightItemEffect = (HighlightItemEffect)effect; effectElement = doc.CreateElement("highlight-item"); effectElement.SetAttribute("idTarget", highlightItemEffect.getTargetId()); effectElement.SetAttribute("animated", (highlightItemEffect.isHighlightAnimated() ? "yes" : "no")); switch (highlightItemEffect.getHighlightType()) { case HighlightItemEffect.HIGHLIGHT_BLUE: effectElement.SetAttribute("type", "blue"); break; case HighlightItemEffect.HIGHLIGHT_BORDER: effectElement.SetAttribute("type", "border"); break; case HighlightItemEffect.HIGHLIGHT_RED: effectElement.SetAttribute("type", "red"); break; case HighlightItemEffect.HIGHLIGHT_GREEN: effectElement.SetAttribute("type", "green"); break; case HighlightItemEffect.NO_HIGHLIGHT: effectElement.SetAttribute("type", "none"); break; } break; case EffectType.RANDOM_EFFECT: var randomEffect = (RandomEffect)effect; effectElement = doc.CreateElement("random-effect"); effectElement.SetAttribute("probability", randomEffect.getProbability().ToString()); var subEffects = new Effects(); if (randomEffect.getPositiveEffect() != null) { subEffects.Add(randomEffect.getPositiveEffect()); if (randomEffect.getNegativeEffect() != null) { subEffects.Add(randomEffect.getNegativeEffect()); } } appendEffects(doc, effectElement, subEffects); break; } return(effectElement); }
public override void OnDoubleClick(Mobile from) { Effects.PlaySound(from, from.Map, 0x505); }
protected void FillNode(XmlNode node, Effects effects, params IDOMWriterParam[] options) { appendEffects(Writer.GetDoc(), node, effects); }
public void CallForAid() { double maxExtraCreatures = 4; int creatures = 2 + (int)(Math.Ceiling(maxExtraCreatures * m_SpawnPercent)); double directionDelay = .25; double initialDelay = 2; double totalDelay = 1 + directionDelay + initialDelay; Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); PublicOverheadMessage(MessageType.Regular, 0, false, "*calls for aid*"); Effects.PlaySound(Location, Map, GetAngerSound()); m_AbilityInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } m_AbilityInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = false; }); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(27, 16, 1, true, false, 0); }); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(Location, Map, GetAngerSound()); for (int a = 0; a < creatures; a++) { Point3D targetLocation = Location; Map map = Map; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, true, true, Location, Map, 1, 15, 1, 5, true); if (m_ValidLocations.Count > 0) { targetLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; } BaseCreature bc_Creature = null; if (m_SpawnPercent <= .25) { switch (Utility.RandomMinMax(1, 1)) { case 1: bc_Creature = new RoyalWhelp(); break; } } else if (m_SpawnPercent <= .50) { switch (Utility.RandomMinMax(1, 3)) { case 1: bc_Creature = new RoyalWhelp(); break; case 2: bc_Creature = new RoyalWhelp(); break; case 3: bc_Creature = new RoyalDrake(); break; } } else { switch (Utility.RandomMinMax(1, 3)) { case 1: bc_Creature = new RoyalWhelp(); break; case 2: bc_Creature = new RoyalDrake(); break; case 3: bc_Creature = new RoyalDragon(); break; } } if (bc_Creature != null) { m_Creatures.Add(bc_Creature); bc_Creature.MoveToWorld(targetLocation, map); bc_Creature.PlaySound(bc_Creature.GetIdleSound()); Effects.SendLocationParticles(EffectItem.Create(targetLocation, map, EffectItem.DefaultDuration), 0x3728, 10, 30, 0, 0, 2023, 0); } } }); }
public override void SendCastEffect() { base.SendCastEffect(); Effects.SendTargetParticles(Caster, 0x3709, 10, 30, 2728, 0, 9907, EffectLayer.LeftFoot, 0); }
public void WingBuffet() { if (!SpecialAbilities.Exists(this)) { return; } int wingFlaps = 3; double flapDuration = 0.5; double minRange = 10; double maxRange = 30; int range = (int)(minRange + ((maxRange - minRange) * m_SpawnPercent)); double totalDelay = 3; Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_AbilityInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } m_AbilityInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_HealthIntervalAbilityInProgress = false; }); PublicOverheadMessage(MessageType.Regular, 0, false, "*furiously beats wings*"); for (int a = 0; a < wingFlaps; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(Location, Map, GetAngerSound()); Animate(19, 10, 2, true, false, 0); }); } Timer.DelayCall(TimeSpan.FromSeconds((double)wingFlaps * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Point3D location = Location; Map map = Map; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(location, range); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); int distance = range - Utility.GetDistance(location, mobile.Location); if (distance < 1) { distance = 1; } double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, damage, distance, -1, "", "The beast buffets you with its wings!"); } }); }
public override void OnDelete() { Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 15, 5042); base.OnDelete(); }
public void FireBarrage() { if (!SpecialAbilities.Exists(this)) { return; } IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); int mobileCount = 0; foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } mobileCount++; } nearbyMobiles.Free(); nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); List <Mobile> m_NearbyMobiles = new List <Mobile>(); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Combatant != null) { if (mobileCount > 1 && mobile == Combatant) { continue; } } m_NearbyMobiles.Add(mobile); } nearbyMobiles.Free(); if (m_NearbyMobiles.Count == 0) { return; } Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)]; int maxExtraFireballs = 10; int fireballs = 10 + (int)Math.Ceiling(((double)maxExtraFireballs * m_SpawnPercent)); double directionDelay = .25; double initialDelay = 1; double fireballDelay = .1; double totalDelay = 1 + directionDelay + initialDelay + ((double)fireballs * fireballDelay); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_AbilityInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_NextFireBarrageAllowed = DateTime.UtcNow + NextFireBarrageDelay; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } m_AbilityInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); m_NextFireBarrageAllowed = DateTime.UtcNow + NextFireBarrageDelay; }); PublicOverheadMessage(MessageType.Regular, 0, false, "*takes deep breath*"); Point3D location = Location; Map map = Map; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; Direction = Utility.GetDirection(Location, targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(5, 15, 1, true, false, 0); PlaySound(GetAngerSound()); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } for (int a = 0; a < fireballs; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * fireballDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (m_HealthIntervalAbilityInProgress) { return; } bool mobileTargetValid = true; if (mobileTarget == null) { mobileTargetValid = false; } else if (mobileTarget.Deleted || !mobileTarget.Alive) { mobileTargetValid = false; } else { if (mobileTarget.Hidden || Utility.GetDistance(Location, mobileTarget.Location) >= FireBarrageRange) { mobileTargetValid = false; } } if (mobileTargetValid) { targetLocation = mobileTarget.Location; targetMap = mobileTarget.Map; } int effectSound = 0x357; int itemID = 0x36D4; int itemHue = 0; int impactSound = 0x226; int impactHue = 0; int xOffset = 0; int yOffset = 0; int distance = Utility.GetDistance(Location, targetLocation); if (distance > 1) { if (Utility.RandomDouble() <= .5) { xOffset = Utility.RandomList(-1, 1); } if (Utility.RandomDouble() <= .5) { yOffset = Utility.RandomList(-1, 1); } } IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 10), map); Point3D adjustedLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z); SpellHelper.AdjustField(ref adjustedLocation, targetMap, 12, false); IEntity endLocation = new Entity(Serial.Zero, new Point3D(adjustedLocation.X, adjustedLocation.Y, adjustedLocation.Z + 10), targetMap); Effects.PlaySound(location, map, effectSound); Effects.SendMovingEffect(startLocation, endLocation, itemID, 8, 0, false, false, itemHue, 0); double targetDistance = Utility.GetDistanceToSqrt(location, adjustedLocation); double destinationDelay = (double)targetDistance * .06; Direction newDirection = Utility.GetDirection(location, adjustedLocation); if (Direction != newDirection) { Direction = newDirection; } Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(adjustedLocation, targetMap, impactSound); Effects.SendLocationParticles(EffectItem.Create(adjustedLocation, targetMap, EffectItem.DefaultDuration), 0x3709, 20, 20, impactHue, 0, 0, 0); Queue m_Queue = new Queue(); nearbyMobiles = targetMap.GetMobilesInRange(adjustedLocation, 0); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); int damage = (int)(Math.Round((double)DamageMin / 5)); if (mobile is BaseCreature) { damage *= 3; } else { if (Utility.GetDistance(Location, mobile.Location) <= 1) { damage = (int)(Math.Round((double)damage * .5)); } } DoHarmful(mobile); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, damage, 0, 100, 0, 0, 0); } }); }); } }); }); }
protected override void OnTarget(Mobile from, object targeted) { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (targeted is UnidentifiedItem) { Container packs = from.Backpack; int nCost = 200; UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted; if (BeggingPose(from) > 0) // LET US SEE IF THEY ARE BEGGING - WIZARD { nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1) { nCost = 1; } } int toConsume = nCost; if (WhatIsIt.VendorCanID != "ArcherGuildmaster") { m_ArcherGuildmaster.SayTo(from, "Sorry, I cannot tell what that is."); } else if (packs.ConsumeTotal(typeof(Gold), toConsume)) { string MyItemName = "item"; Container pack = (Container)targeted; List <Item> items = new List <Item>(); foreach (Item item in pack.Items) { items.Add(item); } foreach (Item item in items) { MyItemName = item.Name; from.AddToBackpack(item); } if (MyItemName == "") { MyItemName = "item"; } from.SendMessage(String.Format("You pay {0} gold.", toConsume)); m_ArcherGuildmaster.SayTo(from, "Let me tell you about this item..."); WhatIsIt.Delete(); } else { m_ArcherGuildmaster.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume); from.SendMessage("You do not have enough gold."); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if ((targeted is BaseWeapon && from.Backpack != null) && (targeted is BaseRanged)) { BaseWeapon bw = targeted as BaseWeapon; Container pack = from.Backpack; int toConsume = 0; if (bw.HitPoints < bw.MaxHitPoints) { int nCost = 10; if (BeggingPose(from) > 0) // LET US SEE IF THEY ARE BEGGING - WIZARD { nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1) { nCost = 1; } toConsume = (bw.MaxHitPoints - bw.HitPoints - 1) * nCost; } else { toConsume = (bw.MaxHitPoints - bw.HitPoints - 1) * nCost; } } else { m_ArcherGuildmaster.SayTo(from, "That does not need to be repaired."); } if (toConsume == 0) { return; } if (pack.ConsumeTotal(typeof(Gold), toConsume)) { if (BeggingPose(from) > 0) { Titles.AwardKarma(from, -BeggingKarma(from), true); } // DO ANY KARMA LOSS m_ArcherGuildmaster.SayTo(from, "Here is your weapon."); from.SendMessage(String.Format("You pay {0} gold.", toConsume)); Effects.PlaySound(from.Location, from.Map, 0x55); bw.MaxHitPoints -= 1; bw.HitPoints = bw.MaxHitPoints; } else { m_ArcherGuildmaster.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume); from.SendMessage("You do not have enough gold."); } } else { m_ArcherGuildmaster.SayTo(from, "I cannot repair that."); } }
protected override bool OnMove(Direction d) { Effects.PlaySound(Location, Map, 0x63E); return(base.OnMove(d)); }
protected override void OnTarget(Mobile from, object target) { if (from == null || target == null) { return; } else if (target == from) { from.SendMessage("You cant shrink yourself!"); } else if (target is PlayerMobile) { from.SendMessage("That person gives you a dirty look."); } else if (target is Item) { from.SendMessage("You can only shrink pets that you own"); } else if (target is BaseBioCreature && FSATS.EnableBioShrink == false) { from.SendMessage("Unnatural creatures cannot be shrunk"); } else if (Server.Spells.SpellHelper.CheckCombat(from)) { from.SendMessage("You cannot shrink your pet while your fighting."); } else if (target is BaseCreature) { BaseCreature c = (BaseCreature)target; bool packanimal = false; Type typ = c.GetType(); string nam = typ.Name; foreach (string ispack in FSATS.PackAnimals) { if (ispack == nam) { packanimal = true; } } if (c.BodyValue == 400 || c.BodyValue == 401 && c.Controlled == false) { from.SendMessage("That person gives you a dirty look."); } else if (c.ControlMaster != from && c.Controlled == false) { from.SendMessage("This is not your pet."); } else if (packanimal == true && (c.Backpack != null && c.Backpack.Items.Count > 0)) { from.SendMessage("You must unload your pets backpack first."); } else if (c.IsDeadPet) { from.SendMessage("You cannot shrink the dead."); } else if (c.Summoned) { from.SendMessage("You cannot shrink a summoned creature."); } else if (c.Combatant != null && c.InRange(c.Combatant, 12) && c.Map == c.Combatant.Map) { from.SendMessage("Your pet is fighting, You cannot shrink it yet."); } else if (c.BodyMod != 0) { from.SendMessage("You cannot shrink your pet while its polymorphed."); } //else if ( Server.Spells.LostArts.CharmBeastSpell.IsCharmed( c ) ) //{ // from.SendMessage( "Your hold over this pet is not strong enough to shrink it." ); //} else if (c.Controlled == true && c.ControlMaster == from) { Type type = c.GetType(); ShrinkItem si = new ShrinkItem(); si.MobType = type; si.Pet = c; si.PetOwner = from; if (c is BaseMount) { BaseMount mount = (BaseMount)c; si.MountID = mount.ItemID; } from.AddToBackpack(si); IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map); IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map); Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(c), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100); from.PlaySound(492); c.Controlled = true; c.ControlMaster = null; c.Internalize(); c.OwnerAbandonTime = DateTime.MinValue; c.IsStabled = true; m_Powder.Charges -= 1; if (m_Powder.Charges == 0) { m_Powder.Delete(); } } } }
public override bool OnFailDisarm(Mobile from) { bool bExploded = false; double rtskill = from.Skills[SkillName.RemoveTrap].Value; double chance = (TrapPower - rtskill) / 800; //make sure there's some chance to trip if (chance <= 0) { chance = .005; //minimum of 1/200 trip } if (chance >= 1) { chance = .995; } chance *= TrapSensitivity; //debug message only available to non-Player level if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance to trip trap: " + chance); } if (Utility.RandomDouble() < chance) { //trap is tripped, effect disarmer int damage = TrapPower / 2 + (Utility.Random(4, 12) * TrapPower / 25) - (int)rtskill / 5; int traptype = 0; traptype = Utility.Random(0, 3); switch (traptype) { case 0: //explosion { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { AOS.Damage(from, damage, 0, 100, 0, 0, 0); from.SendLocalizedMessage(503000); // Your skin blisters from the heat! } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x307); Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15); break; } case 1: //dart { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { AOS.Damage(from, damage / 2, 100, 0, 0, 0, 0); from.SendLocalizedMessage(502380); // A dart embeds... } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x223); //What effect?!? //Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 ); break; } case 2: //poison { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { Poison p = Poison.Lesser; if (damage >= 30) { p = Poison.Regular; } if (damage >= 60) { p = Poison.Greater; } if (damage >= 90) { p = Poison.Deadly; } if (damage >= 100) { p = Poison.Lethal; } from.ApplyPoison(from, p); from.SendLocalizedMessage(503004); // You are enveloped... } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x231); Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x11A6, 20); break; } } from.RevealingAction(); bExploded = true; } return(bExploded); }
public GoToAction(string target) { _target = target; Effects.Add("isNear", target); }
/** * @param effects * the effects to set */ public void setEffects(Effects effects) { this.effects = effects; }
public void Fire(Mobile from) { BaseRanged bow = from.Weapon as BaseRanged; if (bow == null) { SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this. return; } if (DateTime.Now < (m_LastUse + UseDelay)) { return; } Point3D worldLoc = GetWorldLocation(); if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500596); // You would do better to stand in front of the archery butte. return; } if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500597); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if (!from.InRange(worldLoc, 6)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500598); // You are too far away from the archery butte to get an accurate shot. return; } else if (from.InRange(worldLoc, 4)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = (ammoType == typeof(Arrow)); bool isBolt = (ammoType == typeof(Bolt)); bool isKnown = (isArrow || isBolt); if (pack == null || !pack.ConsumeTotal(ammoType, 1)) { if (isArrow) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500594); // You do not have any arrows with which to practice. } else if (isBolt) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500595); // You do not have any crossbow bolts with which to practice. } else { SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this. } return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo(GetWorldLocation()); bow.PlaySwingAnimation(from); from.MovingEffect(this, bow.EffectID, 18, 1, false, false); ScoreEntry se = GetEntryFor(from); /*if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) * { * from.PlaySound( bow.MissSound ); * * PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. * * se.Record( 0 ); * * if ( se.Count == 1 ) * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); * else * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); * * return; * }*/ Effects.PlaySound(Location, Map, 0x2B1); double rand = Utility.RandomDouble(); int area, score, splitScore; if (0.10 > rand) { area = 0; // bullseye score = 50; splitScore = 100; } else if (0.25 > rand) { area = 1; // inner ring score = 10; splitScore = 20; } else if (0.50 > rand) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble()); if (split) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name); if (isArrow) { ++m_Arrows; } else if (isBolt) { ++m_Bolts; } } se.Record(split ? splitScore : score); if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString()); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count)); } }
/** * @param postEffects * the postEffects to set */ public void setPostEffects(Effects postEffects) { this.postEffects = postEffects; }
public override void OnThink() { if (!m_Target.Alive || DateTime.UtcNow > m_ExpireTime) { Kill(); return; } else if (Map != m_Target.Map || !InRange(m_Target, 15)) { Map fromMap = Map; Point3D from = Location; Map toMap = m_Target.Map; Point3D to = m_Target.Location; if (toMap != null) { for (int i = 0; i < 5; ++i) { Point3D loc = new Point3D(to.X - 4 + Utility.Random(9), to.Y - 4 + Utility.Random(9), to.Z); if (toMap.CanSpawnMobile(loc)) { to = loc; break; } else { loc.Z = toMap.GetAverageZ(loc.X, loc.Y); if (toMap.CanSpawnMobile(loc)) { to = loc; break; } } } } Map = toMap; Location = to; ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create(from, fromMap, EffectItem.DefaultDuration), 0x3728, 1, 13, 37, 7, 5023, 0); FixedParticles(0x3728, 1, 13, 5023, 37, 7, EffectLayer.Waist); PlaySound(0x37D); } if (m_Target.Hidden && InRange(m_Target, 3) && Core.TickCount >= NextSkillTime && UseSkill(SkillName.DetectHidden)) { Target targ = Target; if (targ != null) { targ.Invoke(this, this); } } Combatant = m_Target; FocusMob = m_Target; if (AIObject != null) { AIObject.Action = ActionType.Combat; } base.OnThink(); }
public void HandleTranslatedtoShownPosition(Effects.Effect effect) { if (OnShown != null) { OnShown (this); } }
public void Explode(Mobile from, bool direct, Point3D loc, Map map) { if (Deleted) { return; } Consume(); for (int i = 0; m_Users != null && i < m_Users.Count; ++i) { Mobile m = (Mobile)m_Users[i]; ThrowTarget targ = m.Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(m); } } if (map == null) { return; } Effects.PlaySound(loc, map, 0x307); Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0); int alchemyBonus = 0; if (direct) { alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10)); } IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : map.GetMobilesInRange(loc, ExplosionRange); ArrayList toExplode = new ArrayList(); int toDamage = 0; foreach (object o in eable) { if (o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false)))) { toExplode.Add(o); ++toDamage; } else if (o is BaseExplosionPotion && o != this) { toExplode.Add(o); } } eable.Free(); int min = Scale(from, MinDamage); int max = Scale(from, MaxDamage); for (int i = 0; i < toExplode.Count; ++i) { object o = toExplode[i]; if (o is Mobile) { Mobile m = (Mobile)o; if (from != null) { from.DoHarmful(m); } int damage = Utility.RandomMinMax(min, max); damage += alchemyBonus; if (!Core.AOS && damage > 40) { damage = 40; } else if (Core.AOS && toDamage > 2) { damage /= toDamage - 1; } AOS.Damage(m, from, damage, 0, 100, 0, 0, 0); } else if (o is BaseExplosionPotion) { BaseExplosionPotion pot = (BaseExplosionPotion)o; pot.Explode(from, false, pot.GetWorldLocation(), pot.Map); } } }
public void GetNewJet(Effects.EffectItem effect, int jet = 3) { if (effect.ID == 91 | effect.ID == 92 | effect.ID == 93 | effect.ID == 94 | effect.ID == 95 | effect.ID == 96 | effect.ID == 97 | effect.ID == 98 | effect.ID == 99 | effect.ID == 100 | effect.ID == 101) { } else if (effect.ID == 800) { effect.Value3 = 10; // PDV Des familiers ! } else { effect.Value = Utilities.Basic.GetRandomJet(effect.Effect, jet); effect.Value2 = -1; } }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (o is IMageUnlockable mageUnlockable) { mageUnlockable.OnMageUnlock(from); } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else if (cont is TreasureMapChest chest && chest.Level > 2) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } else { int level; int reqSkill; if (cont is TreasureMapChest mapChest) { level = (int)from.Skills[SkillName.Magery].Value; switch (mapChest.Level) { default: case 0: reqSkill = 50; break; case 1: reqSkill = 80; break; case 2: reqSkill = 100; break; } } else { level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; reqSkill = cont.RequiredSkill; } if (level >= reqSkill) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } }