private void cbTick_Checked(object sender, RoutedEventArgs e) { pnMapper.IsEnabled = false; button1.IsEnabled = false; button2.IsEnabled = false; chkSurprised.IsEnabled = false; button3.IsEnabled = false; globalSpellHelper = GenerateValue(); dictKey.Clear(); foreach (var b in globalSpellHelper.Binding) { if (!dictKey.ContainsKey(b.BindedKey)) { dictKey.Add(b.BindedKey, b); } } Disable = false; }
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(); } List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } eable.Free(); } double damage = Utility.Random(27, 22); if (targets.Count > 0) { damage /= targets.Count; double toDeal; for (int i = 0; i < targets.Count; ++i) { toDeal = damage; Mobile m = targets[i]; if (CheckResisted(m)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } toDeal *= GetDamageScalar(m); Caster.DoHarmful(m); SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100); m.BoltEffect(0); } } else { Caster.PlaySound(0x29); } } 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); SpellHelper.GetSurfaceTop(ref p); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if (rx >= 0 && ry >= 0) { eastToWest = false; } else if (rx >= 0) { eastToWest = true; } else if (ry >= 0) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound(p, Caster.Map, 0x20B); TimeSpan duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 7); int itemID = eastToWest ? 0x3946 : 0x3956; for (int i = -2; i <= 2; ++i) { Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z); bool canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false); if (!canFit) { continue; } Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster); item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051); } } FinishSequence(); }
public virtual bool ValidateUse(Mobile m, bool message) { BaseHouse house = BaseHouse.FindHouseAt(this); if (house == null || !IsLockedDown) { if (message) { m.SendMessage("This must be locked down in a house to use!"); } return(false); } if (!house.HasSecureAccess(m, m_Level)) { if (message) { m.SendLocalizedMessage(503301, "", 0x22); // You don't have permission to do that. } return(false); } if (Sigil.ExistsOn(m)) { if (message) { m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } return(false); } if (WeightOverloading.IsOverloaded(m)) { if (message) { m.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } return(false); } if (m.Criminal) { if (message) { m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } return(false); } if (SpellHelper.CheckCombat(m)) { if (message) { m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } return(false); } if (m.Spell != null) { if (message) { m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } return(false); } return(true); }
public void Target(Mobile mobile) { if (!Caster.CanSee(mobile) || mobile.Hidden) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckHSequence(mobile)) { SpellHelper.Turn(Caster, mobile); SpellHelper.CheckReflect((int)this.Circle, Caster, ref mobile); double damage = (double)Utility.RandomMinMax(30, 45); double damageBonus = 0; if (mobile is BaseCreature) { damageBonus += .5; } CheckMagicResist(mobile); bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, mobile, EnhancedSpellbookType.Fire, true, true); Boolean chargedSpellcast = SpellHelper.IsChargedSpell(Caster, mobile, true, Scroll != null); Boolean isTamedTarget = SpellHelper.IsTamedTarget(Caster, mobile); int spellHue = PlayerEnhancementPersistance.GetSpellHueFor(Caster, HueableSpell.Flamestrike); if (enhancedSpellcast) { if (isTamedTarget) { damageBonus += SpellHelper.EnhancedSpellTamedCreatureBonus; } else { damageBonus += SpellHelper.EnhancedSpellBonus; } } if (chargedSpellcast) { if (isTamedTarget) { damageBonus += SpellHelper.ChargedSpellTamedCreatureBonus; } else { damageBonus += SpellHelper.ChargedSpellBonus; } mobile.FixedParticles(0x3709, 10, 60, 5052, spellHue, 0, EffectLayer.LeftFoot); mobile.PlaySound(0x208); } else { mobile.FixedParticles(0x3709, 10, 30, 5052, spellHue, 0, EffectLayer.LeftFoot); mobile.PlaySound(0x208); } damage *= GetDamageScalar(mobile, damageBonus); SpellHelper.Damage(this, Caster, mobile, damage); } FinishSequence(); }
public void Target(Mobile m) { if (!this.Caster.CanSee(m)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (this.CheckHSequence(m)) { SpellHelper.Turn(this.Caster, m); SpellHelper.CheckReflect((int)this.Circle, this.Caster, ref m); if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.Paralyzed = false; int toDrain = 0; if (Core.AOS) { toDrain = (int)(this.GetDamageSkill(this.Caster) - this.GetResistSkill(m)); if (!m.Player) { toDrain /= 2; } if (toDrain < 0) { toDrain = 0; } else if (toDrain > m.Mana) { toDrain = m.Mana; } } else { if (this.CheckResisted(m)) { m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } else { toDrain = m.Mana; } } if (toDrain > (this.Caster.ManaMax - this.Caster.Mana)) { toDrain = this.Caster.ManaMax - this.Caster.Mana; } m.Mana -= toDrain; this.Caster.Mana += toDrain; if (Core.AOS) { m.FixedParticles(0x374A, 1, 15, 5054, 23, 7, EffectLayer.Head); m.PlaySound(0x1F9); this.Caster.FixedParticles(0x0000, 10, 5, 2054, EffectLayer.Head); } else { m.FixedParticles(0x374A, 10, 15, 5054, EffectLayer.Head); m.PlaySound(0x1F9); } this.HarmfulSpell(m); } this.FinishSequence(); }
public static HousePlacementResult Check(Mobile from, int multiID, Point3D center, out ArrayList toMove) { // If this spot is considered valid, every item and mobile in this list will be moved under the house sign toMove = new ArrayList(); Map map = from.Map; if (map == null || map == Map.Internal) { return(HousePlacementResult.BadLand); // A house cannot go here } if (from.AccessLevel >= AccessLevel.GameMaster) { return(HousePlacementResult.Valid); // Staff can place anywhere } if (map == Map.Ilshenar || SpellHelper.IsFeluccaT2A(map, center)) { return(HousePlacementResult.BadRegion); // No houses in Ilshenar/T2A } if (map == Map.Malas && (multiID == 0x007C || multiID == 0x007E)) { return(HousePlacementResult.InvalidCastleKeep); } #region SA if (map == Map.TerMur) { if (from is PlayerMobile && ((PlayerMobile)from).Level < PlayerMobile.Noble) { return(HousePlacementResult.QueensLoyalty); } } #endregion NoHousingRegion noHousingRegion = (NoHousingRegion)Region.Find(center, map).GetRegion(typeof(NoHousingRegion)); if (noHousingRegion != null) { return(HousePlacementResult.BadRegion); } // This holds data describing the internal structure of the house MultiComponentList mcl = MultiData.GetComponents(multiID); if (multiID >= 0x13EC && multiID < 0x1D00) { HouseFoundation.AddStairsTo(ref mcl); // this is a AOS house, add the stairs } // Location of the nortwest-most corner of the house Point3D start = new Point3D(center.X + mcl.Min.X, center.Y + mcl.Min.Y, center.Z); // These are storage lists. They hold items and mobiles found in the map for further processing List <Item> items = new List <Item>(); List <Mobile> mobiles = new List <Mobile>(); // These are also storage lists. They hold location values indicating the yard and border locations. List <Point2D> yard = new List <Point2D>(), borders = new List <Point2D>(); /* RULES: * * 1) All tiles which are around the -outside- of the foundation must not have anything impassable. * 2) No impassable object or land tile may come in direct contact with any part of the house. * 3) Five tiles from the front and back of the house must be completely clear of all house tiles. * 4) The foundation must rest flatly on a surface. Any bumps around the foundation are not allowed. * 5) No foundation tile may reside over terrain which is viewed as a road. */ for (int x = 0; x < mcl.Width; ++x) { for (int y = 0; y < mcl.Height; ++y) { int tileX = start.X + x; int tileY = start.Y + y; StaticTile[] addTiles = mcl.Tiles[x][y]; if (addTiles.Length == 0) { continue; // There are no tiles here, continue checking somewhere else } Point3D testPoint = new Point3D(tileX, tileY, center.Z); Region reg = Region.Find(testPoint, map); if (!reg.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc { if (reg.IsPartOf(typeof(TempNoHousingRegion))) { return(HousePlacementResult.BadRegionTemp); } if (reg.IsPartOf(typeof(TreasureRegion)) || reg.IsPartOf(typeof(HouseRegion))) { return(HousePlacementResult.BadRegionHidden); } if (reg.IsPartOf(typeof(HouseRaffleRegion))) { return(HousePlacementResult.BadRegionRaffle); } return(HousePlacementResult.BadRegion); } LandTile landTile = map.Tiles.GetLandTile(tileX, tileY); int landID = landTile.ID & TileData.MaxLandValue; StaticTile[] oldTiles = map.Tiles.GetStaticTiles(tileX, tileY, true); Sector sector = map.GetSector(tileX, tileY); items.Clear(); for (int i = 0; i < sector.Items.Count; ++i) { Item item = sector.Items[i]; if (item.Visible && item.X == tileX && item.Y == tileY) { items.Add(item); } } mobiles.Clear(); for (int i = 0; i < sector.Mobiles.Count; ++i) { Mobile m = sector.Mobiles[i]; if (m.X == tileX && m.Y == tileY) { mobiles.Add(m); } } int landStartZ = 0, landAvgZ = 0, landTopZ = 0; map.GetAverageZ(tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ); bool hasFoundation = false; for (int i = 0; i < addTiles.Length; ++i) { StaticTile addTile = addTiles[i]; if (addTile.ID == 0x1) // Nodraw { continue; } TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags; bool isFoundation = (addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0); bool hasSurface = false; if (isFoundation) { hasFoundation = true; } int addTileZ = center.Z + addTile.Z; int addTileTop = addTileZ + addTile.Height; if ((addTileFlags & TileFlag.Surface) != 0) { addTileTop += 16; } if (addTileTop > landStartZ && landAvgZ > addTileZ) { return(HousePlacementResult.BadLand); // Broke rule #2 } if (isFoundation && ((TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0) && landAvgZ == center.Z) { hasSurface = true; } for (int j = 0; j < oldTiles.Length; ++j) { StaticTile oldTile = oldTiles[j]; ItemData id = TileData.ItemTable[oldTile.ID & TileData.MaxItemValue]; if ((id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) && addTileTop > oldTile.Z && (oldTile.Z + id.CalcHeight) > addTileZ) { return(HousePlacementResult.BadStatic); // Broke rule #2 } /*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (oldTile.Z + id.CalcHeight) == center.Z ) * hasSurface = true;*/ } for (int j = 0; j < items.Count; ++j) { Item item = items[j]; ItemData id = item.ItemData; if (addTileTop > item.Z && (item.Z + id.CalcHeight) > addTileZ) { if (item.Movable) { toMove.Add(item); } else if ((id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0))) { return(HousePlacementResult.BadItem); // Broke rule #2 } } /*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (item.Z + id.CalcHeight) == center.Z ) * { * hasSurface = true; * }*/ } if (isFoundation && !hasSurface) { return(HousePlacementResult.NoSurface); // Broke rule #4 } for (int j = 0; j < mobiles.Count; ++j) { Mobile m = mobiles[j]; if (addTileTop > m.Z && (m.Z + 16) > addTileZ) { toMove.Add(m); } } } for (int i = 0; i < m_RoadIDs.Length; i += 2) { if (landID >= m_RoadIDs[i] && landID <= m_RoadIDs[i + 1]) { return(HousePlacementResult.BadLand); // Broke rule #5 } } if (hasFoundation) { for (int xOffset = -1; xOffset <= 1; ++xOffset) { for (int yOffset = -YardSize; yOffset <= YardSize; ++yOffset) { Point2D yardPoint = new Point2D(tileX + xOffset, tileY + yOffset); if (!yard.Contains(yardPoint)) { yard.Add(yardPoint); } } } for (int xOffset = -1; xOffset <= 1; ++xOffset) { for (int yOffset = -1; yOffset <= 1; ++yOffset) { if (xOffset == 0 && yOffset == 0) { continue; } // To ease this rule, we will not add to the border list if the tile here is under a base floor (z<=8) int vx = x + xOffset; int vy = y + yOffset; if (vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height) { StaticTile[] breakTiles = mcl.Tiles[vx][vy]; bool shouldBreak = false; for (int i = 0; !shouldBreak && i < breakTiles.Length; ++i) { StaticTile breakTile = breakTiles[i]; if (breakTile.Height == 0 && breakTile.Z <= 8 && TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface) { shouldBreak = true; } } if (shouldBreak) { continue; } } Point2D borderPoint = new Point2D(tileX + xOffset, tileY + yOffset); if (!borders.Contains(borderPoint)) { borders.Add(borderPoint); } } } } } } for (int i = 0; i < borders.Count; ++i) { Point2D borderPoint = borders[i]; LandTile landTile = map.Tiles.GetLandTile(borderPoint.X, borderPoint.Y); int landID = landTile.ID & TileData.MaxLandValue; if ((TileData.LandTable[landID].Flags & TileFlag.Impassable) != 0) { return(HousePlacementResult.BadLand); } for (int j = 0; j < m_RoadIDs.Length; j += 2) { if (landID >= m_RoadIDs[j] && landID <= m_RoadIDs[j + 1]) { return(HousePlacementResult.BadLand); // Broke rule #5 } } StaticTile[] tiles = map.Tiles.GetStaticTiles(borderPoint.X, borderPoint.Y, true); for (int j = 0; j < tiles.Length; ++j) { StaticTile tile = tiles[j]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; if (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (tile.Z + id.CalcHeight) > (center.Z + 2))) { return(HousePlacementResult.BadStatic); // Broke rule #1 } } Sector sector = map.GetSector(borderPoint.X, borderPoint.Y); List <Item> sectorItems = sector.Items; for (int j = 0; j < sectorItems.Count; ++j) { Item item = sectorItems[j]; if (item.X != borderPoint.X || item.Y != borderPoint.Y || item.Movable) { continue; } ItemData id = item.ItemData; if (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (item.Z + id.CalcHeight) > (center.Z + 2))) { return(HousePlacementResult.BadItem); // Broke rule #1 } } } List <Sector> _sectors = new List <Sector>(); List <BaseHouse> _houses = new List <BaseHouse>(); for (int i = 0; i < yard.Count; i++) { Sector sector = map.GetSector(yard[i]); if (!_sectors.Contains(sector)) { _sectors.Add(sector); if (sector.Multis != null) { for (int j = 0; j < sector.Multis.Count; j++) { if (sector.Multis[j] is BaseHouse) { BaseHouse _house = (BaseHouse)sector.Multis[j]; if (!_houses.Contains(_house)) { _houses.Add(_house); } } } } } } for (int i = 0; i < yard.Count; ++i) { foreach (BaseHouse b in _houses) { if (b.Contains(yard[i])) { return(HousePlacementResult.BadStatic); // Broke rule #3 } } /*Point2D yardPoint = yard[i]; * IPooledEnumerable eable = map.GetMultiTilesAt( yardPoint.X, yardPoint.Y ); * foreach ( StaticTile[] tile in eable ) * { * for ( int j = 0; j < tile.Length; ++j ) * { * if ( (TileData.ItemTable[tile[j].ID & TileData.MaxItemValue].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0 ) * { * eable.Free(); * return HousePlacementResult.BadStatic; // Broke rule #3 * } * } * } * eable.Free();*/ } return(HousePlacementResult.Valid); }
public static bool CanDetect(Mobile src, Mobile target, bool direct) { if (src.Map == null || target.Map == null || !src.CanBeHarmful(target, false, false, true)) { return(false); } // No invulnerable NPC's if (src.Blessed || src is BaseCreature creature && creature.IsInvulnerable) { return(false); } if (target.Blessed || target is BaseCreature baseCreature && baseCreature.IsInvulnerable) { return(false); } SpellHelper.CheckResponsible(ref src); SpellHelper.CheckResponsible(ref target); if (src.Map.Rules == MapRules.FeluccaRules && direct) { return(!SpellHelper.IsGuildAllyOrParty(src, target)); } // pet owner, guild/alliance, party if (!SpellHelper.ValidIndirectTarget(target, src)) { return(false); } // Checked aggressed/aggressors bool aggressed = false; for (var index = 0; index < src.Aggressed.Count; index++) { var x = src.Aggressed[index]; if (x.Defender == target) { aggressed = true; break; } } bool aggressors = false; for (var index = 0; index < src.Aggressors.Count; index++) { var x = src.Aggressors[index]; if (x.Attacker == target) { aggressors = true; break; } } if (aggressed || aggressors) { return(true); } return(src.Map.Rules == MapRules.FeluccaRules); }
public void Use(Mobile from, IPoint3D loc) { if (!CheckUse(from)) { return; } from.BeginAction(typeof(FireHorn)); Timer.DelayCall(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndAction), from); int music = from.Skills[SkillName.Musicianship].Fixed; int sucChance = 500 + (music - 775) * 2; double dSucChance = sucChance / 1000.0; if (!from.CheckSkill(SkillName.Musicianship, dSucChance)) { from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak. from.PlaySound(0x18A); return; } int sulfAsh = Core.AOS ? 4 : 15; from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh); from.PlaySound(0x15F); Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0)); var targets = SpellHelper.AcquireIndirectTargets(from, loc, from.Map, 2).OfType <Mobile>().ToList(); var count = targets.Count; bool playerVsPlayer = targets.Any(t => t.Player); if (count > 0) { int prov = from.Skills[SkillName.Provocation].Fixed; int disc = from.Skills[SkillName.Discordance].Fixed; int peace = from.Skills[SkillName.Peacemaking].Fixed; int minDamage, maxDamage; if (Core.AOS) { int musicScaled = music + Math.Max(0, music - 900) * 2; int provScaled = prov + Math.Max(0, prov - 900) * 2; int discScaled = disc + Math.Max(0, disc - 900) * 2; int peaceScaled = peace + Math.Max(0, peace - 900) * 2; int weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80; int avgDamage; if (playerVsPlayer) { avgDamage = weightAvg / 3; } else { avgDamage = weightAvg / 2; } minDamage = (avgDamage * 9) / 10; maxDamage = (avgDamage * 10) / 9; } else { int total = prov + disc / 5 + peace / 5; if (playerVsPlayer) { total /= 3; } maxDamage = (total * 2) / 30; minDamage = (maxDamage * 7) / 10; } double damage = Utility.RandomMinMax(minDamage, maxDamage); if (Core.AOS && count > 1) { damage = (damage * 2) / count; } else if (!Core.AOS) { damage /= count; } foreach (var m in targets) { double toDeal = damage; if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } from.DoHarmful(m); SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0); Effects.SendTargetEffect(m, 0x3709, 10, 30); } } ColUtility.Free(targets); double breakChance = Core.AOS ? 0.01 : 0.16; if (Utility.RandomDouble() < breakChance) { from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands. Delete(); } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); SpellHelper.CheckReflect((int)Circle, Caster, ref m); if (Mysticism.StoneFormSpell.CheckImmunity(m)) { Caster.SendLocalizedMessage(1080192); // Your target resists your ability reduction magic. return; } int oldOffset = SpellHelper.GetCurseOffset(m, StatType.Str); int newOffset = SpellHelper.GetOffset(Caster, m, StatType.Str, true, false); if (-newOffset > oldOffset || newOffset == 0) { DoHurtFizzle(); } else { if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.Paralyzed = false; m.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head); m.PlaySound(0x1DF); HarmfulSpell(m); if (-newOffset < oldOffset) { SpellHelper.AddStatCurse(this.Caster, m, StatType.Str, false, newOffset); int percentage = (int)(SpellHelper.GetOffsetScalar(this.Caster, m, true) * 100); TimeSpan length = SpellHelper.GetDuration(this.Caster, m); var ssDurationBonusSeconds = this.Caster.Skills[SkillName.SpiritSpeak].Value; length.Add(TimeSpan.FromSeconds(ssDurationBonusSeconds)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Weaken, 1075837, length, m, percentage.ToString())); if (m_Table.ContainsKey(m)) { m_Table[m].Stop(); } m_Table[m] = Timer.DelayCall(length, () => { RemoveEffects(m); }); } } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3); foreach (Mobile m in eable) { if (Caster.CanBeBeneficial(m, false)) { targets.Add(m); } } eable.Free(); } if (Core.AOS) { Party party = Party.Get(Caster); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; if (m == Caster || (party != null && party.Contains(m))) { Caster.DoBeneficial(m); Spells.Second.ProtectionSpell.Toggle(Caster, m); } } } else { Effects.PlaySound(p, Caster.Map, 0x299); int val = (int)(Caster.Skills[SkillName.Magery].Value / 10.0 + 1); if (targets.Count > 0) { for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; if (m.BeginAction(typeof(ArchProtectionSpell))) { Caster.DoBeneficial(m); m.VirtualArmorMod += val; AddEntry(m, val); new InternalTimer(m, Caster).Start(); m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist); m.PlaySound(0x1F7); } } } } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && SpellHelper.CheckWater(new Point3D(p), Caster.Map) && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if (rx >= 0 && ry >= 0) { eastToWest = false; } else if (rx >= 0) { eastToWest = true; } else if (ry >= 0) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound(p, Caster.Map, 0x20B); int itemID = eastToWest ? 0x3915 : 0x3922; Point3D pnt = new Point3D(p); TimeSpan duration = TimeSpan.FromSeconds(3 + (Caster.Skills.Magery.Fixed / 25)); if (SpellHelper.CheckField(pnt, Caster.Map)) { new InternalItem(itemID, pnt, Caster, Caster.Map, duration); } for (int i = 1; i <= 2; ++i) { Timer.DelayCall <int>(TimeSpan.FromMilliseconds(i * 300), index => { Point3D point = new Point3D(eastToWest ? pnt.X + index : pnt.X, eastToWest ? pnt.Y : pnt.Y + index, pnt.Z); SpellHelper.AdjustField(ref point, Caster.Map, 16, false); if (SpellHelper.CheckField(point, Caster.Map)) { new InternalItem(itemID, point, Caster, Caster.Map, duration); } point = new Point3D(eastToWest ? pnt.X + -index : pnt.X, eastToWest ? pnt.Y : pnt.Y + -index, pnt.Z); SpellHelper.AdjustField(ref point, Caster.Map, 16, false); if (SpellHelper.CheckField(point, Caster.Map)) { new InternalItem(itemID, point, Caster, Caster.Map, duration); } }, i); } } FinishSequence(); }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (DateTime.UtcNow > m_Item.m_End) { m_Item.Delete(); Stop(); } else { Map map = m_Item.Map; Mobile caster = m_Item.m_Caster; if (map != null && caster != null) { bool eastToWest = (m_Item.ItemID == 0x3915); IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1))); foreach (Mobile m in eable) { if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && m != caster && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } eable.Free(); while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); caster.DoHarmful(m); m_Item.ApplyPoisonTo(m); m.PlaySound(0x474); } } } }
public void OnTarget(Mobile from, object obj) { if (Deleted || InUse) { return; } if (!(obj is IPoint3D p3D)) { return; } Map map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (!from.InLOS(obj)) { from.SendLocalizedMessage(500979); // You cannot see that location. } else if (RequireDeepWater ? FullValidation(map, x, y) : ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z)) { Point3D p = new Point3D(x, y, z); if (GetType() == typeof(SpecialFishingNet)) { for (int i = 1; i < Amount; ++i) // these were stackable before, doh { from.AddToBackpack(new SpecialFishingNet()); } } InUse = true; Movable = false; MoveToWorld(p, map); SpellHelper.Turn(from, p); from.Animate(12, 5, 1, true, false, 0); Effects.SendLocationEffect(p, map, 0x352D, 16, 4); Effects.PlaySound(p, map, 0x364); int index = 0; Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 14, () => DoEffect(from, p, index++)); from.SendLocalizedMessage(RequireDeepWater ? 1010487 : 1074492); // You plunge the net into the sea... / You plunge the net into the water... } else { from.SendLocalizedMessage(RequireDeepWater ? 1010485 : 1074491); // You can only use this net in deep water! / You can only use this net in water! } }
public void Target(IPoint3D p) { if (!this.Caster.CanSee(p)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (this.CheckSequence()) { SpellHelper.Turn(this.Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = this.Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); foreach (Mobile m in eable) { if (m is BaseCreature && (m as BaseCreature).IsDispellable && (((BaseCreature)m).SummonMaster == this.Caster || this.Caster.CanBeHarmful(m, false))) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (bc == null) { continue; } double dispelChance = (50.0 + ((100 * (this.Caster.Skills.Magery.Value - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100; // Skill Masteries dispelChance -= ((double)SkillMasteries.MasteryInfo.EnchantedSummoningBonus(bc) / 100); if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); } else { this.Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); } } } this.FinishSequence(); }
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, true, "That did not need to be unlocked."); // That did not need to be unlocked. } else if (!(o is LockableContainer)) { from.SendAsciiMessage("You can't unlock that!"); // 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, true, "That did not need to be unlocked."); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendAsciiMessage("You can't unlock that!"); // You can't unlock that! } else { int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; if (level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "My spell does not seem to have an effect on that lock."); // My spell does not seem to have an effect on that lock. } } } } m_Owner.FinishSequence(); }
public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false) { if (Factions.Sigil.ExistsOn(this.Caster)) { this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (map == null || (!Core.AOS && this.Caster.Map != map)) { this.Caster.SendLocalizedMessage(1005570); // You can not gate to another facet. } else if (!SpellHelper.CheckTravel(this.Caster, TravelCheckType.GateFrom)) { } else if (!SpellHelper.CheckTravel(this.Caster, map, loc, TravelCheckType.GateTo)) { } else if (map == Map.Felucca && this.Caster is PlayerMobile && ((PlayerMobile)this.Caster).Young) { this.Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. } else if (this.Caster.Murderer && map.Rules != MapRules.FeluccaRules && !Siege.SiegeShard) { this.Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there. } else if (this.Caster.Criminal) { this.Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (SpellHelper.CheckCombat(this.Caster)) { this.Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey) { this.Caster.SendLocalizedMessage(501942); // That location is blocked. } else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey) { this.Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (Core.SE && (this.GateExistsAt(map, loc) || this.GateExistsAt(this.Caster.Map, this.Caster.Location))) // SE restricted stacking gates { this.Caster.SendLocalizedMessage(1071242); // There is already a gate there. } else if (Server.Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster)) { Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order. } else if (this.CheckSequence()) { Timer.DelayCall(TimeSpan.FromSeconds(1), () => { Caster.SendLocalizedMessage(501024); // You open a magical gate to another location Effects.PlaySound(this.Caster.Location, this.Caster.Map, 0x20E); InternalItem firstGate = new InternalItem(loc, map); firstGate.MoveToWorld(this.Caster.Location, this.Caster.Map); Effects.PlaySound(loc, map, 0x20E); InternalItem secondGate = new InternalItem(this.Caster.Location, this.Caster.Map); secondGate.MoveToWorld(loc, map); firstGate.LinkedGate = secondGate; secondGate.LinkedGate = firstGate; firstGate.BoatGate = BaseBoat.FindBoatAt(firstGate, firstGate.Map) != null; secondGate.BoatGate = BaseBoat.FindBoatAt(secondGate, secondGate.Map) != null; }); } this.FinishSequence(); }
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 / 10); } IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : (IPooledEnumerable)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; m.Damage(damage, from); } else if (o is BaseExplosionPotion) { BaseExplosionPotion pot = (BaseExplosionPotion)o; pot.Explode(from, false, pot.GetWorldLocation(), pot.Map); } } }
public static bool CanTravelTo(Mobile m, Point3D p, Map map) { return(!(Region.Find(p, map) is DungeonRegion) && !SpellHelper.IsAnyT2A(map, p) && !SpellHelper.IsIlshenar(map, p)); }
public override void OnCast() { BaseWeapon wep = GetWeapon(); if (wep != null && CheckSequence()) { wep.PlaySwingAnimation(Caster); TimeSpan duration = TimeSpan.FromMinutes(1); double skill = (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2; _HCIBonus = (int)Math.Max(45, skill / 2.667); _SSIBonus = (int)Math.Max(30, skill / 4); string args = String.Format("{0}\t{1}\t{2}", Caster.Name, _HCIBonus.ToString(), _SSIBonus.ToString()); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.PlayingTheOddsDebuff, 1155913, 1156091, duration, Caster)); //Your bow range has been reduced as you play the odds. List <Mobile> list = GetParty(); foreach (Mobile m in list.Where(mob => mob is PlayerMobile)) { m.PlaySound(0x101); m.FixedEffect(0x13B2, 10, 20, 2728, 5); m.FixedEffect(0x37C4, 10, 20, 2728, 5); if (m != Caster) { BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PlayingTheOdds, 1155913, 1155998, duration, m, args)); } //~1_NAME~ grants you the following:<br>+~2_VAl~% Hit Chance Increase.<br>+~3_VAL~% Swing Speed Increase. } ColUtility.Free(list); Caster.SendLocalizedMessage(1156091); // Your bow range has been reduced as you play the odds. Expires = DateTime.UtcNow + duration; BeginTimer(); AddToCooldown(TimeSpan.FromSeconds(90)); IPooledEnumerable eable = Caster.Map.GetMobilesInRange(Caster.Location, 5); List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in eable) { if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { if (!Caster.InLOS(m)) { continue; } targets.Add(m); } } eable.Free(); foreach (Mobile mob in targets) { if (HitLower.ApplyDefense(mob)) { if (wep is BaseRanged && !(wep is BaseThrown)) { Caster.MovingEffect(mob, ((BaseRanged)wep).EffectID, 18, 1, false, false); } mob.PlaySound(0x28E); Effects.SendTargetEffect(mob, 0x37BE, 1, 4, 0x23, 3); Caster.DoHarmful(mob); } } wep.InvalidateProperties(); } FinishSequence(); }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (!m_Item.Visible) { if (m_InLOS && m_CanFit) { m_Item.Visible = true; } else { m_Item.Delete(); } if (!m_Item.Deleted) { m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040); } } else if (DateTime.Now > m_Item.m_End) { m_Item.Delete(); Stop(); } else { Map map = m_Item.Map; Mobile caster = m_Item.m_Caster; if (map != null && caster != null) { bool eastToWest = m_Item.ItemID == 0x3915; IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), eastToWest ? 1 : 2, eastToWest ? 2 : 1)); foreach (Mobile m in eable) { if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } eable.Free(); while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); caster.DoHarmful(m); m_Item.ApplyPoisonTo(m); m.PlaySound(0x474); } } } }
public void Target(Mobile m) { if (m is PlayerMobile) { Caster.SendLocalizedMessage(1060508); // You can't curse that. return; } if (Caster == m || !(m is PlayerMobile || m is BaseCreature)) // only PlayerMobile and BaseCreature implement blood oath checking { Caster.SendLocalizedMessage(1060508); // You can't curse that. } else if (m_OathTable.Contains(Caster)) { Caster.SendLocalizedMessage(1061607); // You are already bonded in a Blood Oath. } else if (m_OathTable.Contains(m)) { if (m.Player) { Caster.SendLocalizedMessage(1061608); // That player is already bonded in a Blood Oath. } else { Caster.SendLocalizedMessage(1061609); // That creature is already bonded in a Blood Oath. } } else if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Temporarily creates a dark pact between the caster and the target. * Any damage dealt by the target to the caster is increased, but the target receives the same amount of damage. * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 80 ) + 8 seconds. * * NOTE: The above algorithm must be fixed point, it should be: * ((ss-rm)/8)+8 */ ExpireTimer timer = (ExpireTimer)m_Table[m]; if (timer != null) { timer.DoExpire(); } m_OathTable[Caster] = Caster; m_OathTable[m] = Caster; if (m.Spell != null) { m.Spell.OnCasterHurt(); } Caster.PlaySound(0x175); Caster.FixedParticles(0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist); Caster.FixedParticles(0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255); m.FixedParticles(0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist); m.FixedParticles(0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255); TimeSpan duration = TimeSpan.FromSeconds(((GetDamageSkill(Caster) - GetResistSkill(m)) / 8) + 8); m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); //Skill check for gain timer = new ExpireTimer(Caster, m, duration); timer.Start(); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name.ToString())); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name.ToString())); m_Table[m] = timer; HarmfulSpell(m); } FinishSequence(); }
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) { ((IMageUnlockable)o).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 && ((TreasureMapChest)cont).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 && TreasureMapInfo.NewSystem) { level = (int)from.Skills[SkillName.Magery].Value; switch (((TreasureMapChest)cont).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. } } } } m_Owner.FinishSequence(); }
public override void Drink(Mobile from) { if (this != null && ParentEntity != from.Backpack) { from.SendMessage("The potion must be in your pack to drink it."); } else { if (!from.CanBeginAction(typeof(UOACZLesserConfusionPotion))) { from.SendMessage("You must wait before using another potion of that type."); return; } from.BeginAction(typeof(UOACZLesserConfusionPotion)); Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { from.EndAction(typeof(UOACZLesserConfusionPotion)); }); Consume(); Point3D location = from.Location; Map map = from.Map; int range = 2; double duration = 5; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(location, range); foreach (Mobile mobile in nearbyMobiles) { if (mobile == from) { continue; } if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } if (!(mobile is BaseCreature)) { continue; } bool validCombatant = false; if (mobile.Combatant != null && mobile.Combatant == from) { validCombatant = true; } foreach (AggressorInfo aggressor in from.Aggressors) { if (aggressor.Attacker == mobile || aggressor.Defender == mobile) { validCombatant = true; } } foreach (AggressorInfo aggressed in from.Aggressed) { if (aggressed.Attacker == mobile || aggressed.Defender == mobile) { validCombatant = true; } } if (mobile is UOACZBaseHuman && !validCombatant) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { BaseCreature bc_Creature = (BaseCreature)m_Queue.Dequeue(); bc_Creature.Pacify(from, TimeSpan.FromSeconds(duration), false); } for (int a = 0; a < 30; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * .05), delegate { if (!UOACZPersistance.Active) { return; } Point3D effectLocation = new Point3D(location.X + Utility.RandomMinMax(-1 * range, range), location.Y + Utility.RandomMinMax(-1 * range, range), location.Z); SpellHelper.AdjustField(ref effectLocation, map, 12, false); IEntity explosionLocationEntity = new Entity(Serial.Zero, new Point3D(effectLocation.X, effectLocation.Y, effectLocation.Z - 1), map); switch (Utility.RandomMinMax(1, 3)) { case 1: Effects.SendLocationParticles(explosionLocationEntity, 0x37B9, 10, 6, 0, 0, 5044, 0); break; case 2: Effects.SendLocationParticles(explosionLocationEntity, 0x372A, 10, 20, 0, 0, 5029, 0); break; case 3: Effects.SendLocationParticles(explosionLocationEntity, Utility.RandomList(0x36BD, 0x36BF, 0x36CB, 0x36BC), 30, 7, 2499, 0, 5044, 0); break; } Effects.SendLocationParticles(explosionLocationEntity, 0x3709, 10, 30, 2499, 0, 5029, 0); Effects.PlaySound(explosionLocationEntity.Location, map, Utility.RandomList(0x22A, 0x229)); }); } } }
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(); } List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); bool CanAffect = true; SlayerEntry undead = SlayerGroup.GetEntryByName(SlayerName.Silver); SlayerEntry elly = SlayerGroup.GetEntryByName(SlayerName.ElementalBan); SlayerEntry golem = SlayerGroup.GetEntryByName(SlayerName.GolemDestruction); foreach (Mobile m in eable) { CanAffect = true; Mobile pet = m; if (m is BaseCreature) { pet = ((BaseCreature)m).GetMaster(); } if (m is BaseCreature) { if (undead.Slays(m) || elly.Slays(m) || golem.Slays(m)) { CanAffect = false; } } if (Caster.Region == m.Region && Caster != m && Caster != pet && Caster.InLOS(m) && m.Blessed == false && Caster.CanBeHarmful(m, true) && !m.Paralyzed && CanAffect) { targets.Add(m); } } eable.Free(); } if (targets.Count > 0) { Caster.PlaySound(0x651); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; SpellHelper.Turn(Caster, m); SpellHelper.CheckReflect(CirclePower, Caster, ref m); TimeSpan duration = TimeSpan.FromSeconds((DamagingSkill(Caster) / 4)); m.Paralyze(duration); new SleepyTimer(m, duration, Caster).Start(); HarmfulSpell(m); } Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, true); } } FinishSequence(); }
public override void OnCast() { if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence()) { var targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0))) { if (Caster != m && /*SpellHelper.ValidIndirectTarget( Caster, m )*/ Caster.CanBeHarmful(m, false) && (!Caster.EraAOS || Caster.InLOS(m))) //hurt everyone but caster { targets.Add(m); } } } Caster.PlaySound(0x220); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; int damage; if (Caster.EraAOS) { damage = m.Hits / 2; if (!m.Player) { damage = Math.Max(Math.Min(damage, 100), 15); } damage += Utility.Random(16); } else if (Caster.EraUOR) { //damage = (m.Hits * 6) / 10; damage = 0; //split between all hurts mobs if (!m.Player && damage < 10) { damage = 10; } else if (damage > 75) { damage = 75; } } else { // HACK: Convert to T2A mechanics. //damage = (m.Hits * 6) / 10; damage = 0; //split between all hurts mobs if (!m.Player && damage < 10) { damage = 10; } else if (damage > 75) { damage = 75; } } //Caster.DoHarmful( m ); SpellHelper.Damage(this, m, damage); } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p) && !Caster.InLOS(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(); } List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; bool playerVsPlayer = false; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { if (Core.AOS && !Caster.InLOS(m)) { continue; } targets.Add(m); if (m.Player) { playerVsPlayer = true; } } } eable.Free(); } if (targets.Count > 0) { double damage; if (Core.AOS) { damage = GetNewAosDamage(51, 1, 5, playerVsPlayer); } else { damage = GetPreUORDamage(); } if (targets.Count > 2) { damage = (damage * 2) / targets.Count; } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; double toDeal = damage; if (!Core.AOS && CheckResisted(m)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } Caster.DoHarmful(m); SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100); m.BoltEffect(0); } } } FinishSequence(); }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 0) // Cancel { return; } if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null) { return; } var switches = info.Switches; if (switches.Length == 0) { return; } var switchID = switches[0]; var listIndex = switchID / 100; var listEntry = switchID % 100; if (listIndex < 0 || listIndex >= m_Lists.Length) { return; } var list = m_Lists[listIndex]; if (listEntry < 0 || listEntry >= list.Entries.Length) { return; } var entry = list.Entries[listEntry]; if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1)) { m_Mobile.SendLocalizedMessage(1019003); // You are already there. return; } if (m_Mobile.IsStaff()) { //Staff can always use a gate! } else if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map) { m_Mobile.SendLocalizedMessage(1019002); // You are too far away to use the gate. return; } else if (m_Mobile.Player && m_Mobile.Murderer && list.Map != Map.Felucca && !Siege.SiegeShard) { m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. return; } else if (Sigil.ExistsOn(m_Mobile) && list.Map != Faction.Facet) { m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. return; } else if (m_Mobile.Criminal) { m_Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. return; } else if (SpellHelper.CheckCombat(m_Mobile)) { m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? return; } else if (m_Mobile.Spell != null) { m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. return; } BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map); m_Mobile.Combatant = null; m_Mobile.Warmode = false; m_Mobile.Hidden = true; m_Mobile.MoveToWorld(entry.Location, list.Map); Effects.PlaySound(entry.Location, list.Map, 0x1FE); CityTradeSystem.OnPublicMoongateUsed(m_Mobile); }
public override void OnThink() { if (DateTime.UtcNow >= m_NextAbilityTime) { JukaLord toBuff = null; foreach (Mobile m in this.GetMobilesInRange(8)) { if (m is JukaLord && IsFriend(m) && m.Combatant != null && CanBeBeneficial(m) && m.CanBeginAction(typeof(JukaMage)) && InLOS(m)) { toBuff = (JukaLord)m; break; } } if (toBuff != null) { if (CanBeBeneficial(toBuff) && toBuff.BeginAction(typeof(JukaMage))) { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60)); toBuff.Say(true, "Give me the power to destroy my enemies!"); this.Say(true, "Fight well my lord!"); DoBeneficial(toBuff); object[] state = new object[] { toBuff, toBuff.HitsMaxSeed, toBuff.RawStr, toBuff.RawDex }; SpellHelper.Turn(this, toBuff); int toScale = toBuff.HitsMaxSeed; if (toScale > 0) { toBuff.HitsMaxSeed += AOS.Scale(toScale, 75); toBuff.Hits += AOS.Scale(toScale, 75); } toScale = toBuff.RawStr; if (toScale > 0) { toBuff.RawStr += AOS.Scale(toScale, 50); } toScale = toBuff.RawDex; if (toScale > 0) { toBuff.RawDex += AOS.Scale(toScale, 50); toBuff.Stam += AOS.Scale(toScale, 50); } toBuff.Hits = toBuff.Hits; toBuff.Stam = toBuff.Stam; toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist); toBuff.PlaySound(0x1EE); Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(Unbuff), state); } } else { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5)); } } base.OnThink(); }
public void RaiseRocks() { if (Map == null) return; IPooledEnumerable eable = Map.GetMobilesInRange(Location, 12); List<Mobile> random = new List<Mobile>(); foreach (Mobile m in eable) { if (m.Alive && m is PlayerMobile && SpellHelper.ValidIndirectTarget(this, m) && CanBeHarmful(m, false)) random.Add(m); } eable.Free(); Mobile target = null; if (random.Count > 0) target = random[Utility.Random(random.Count)]; if (target != null) { Direction d = Utility.GetDirection(this, target); Rectangle2D r = new Rectangle2D(target.X - 8, target.Y - 2, 17, 5); switch (d) { case Direction.West: r = new Rectangle2D(X - 24, Y - 2, 20, 5); break; case Direction.North: r = new Rectangle2D(X - 2, Y - 24, 5, 20); break; case Direction.East: r = new Rectangle2D(X + 4, Y - 2, 20, 5); break; case Direction.South: r = new Rectangle2D(X - 4, Y + 4, 20, 5); break; } for (int x = r.X; x <= r.X + r.Width; x++) { for (int y = r.Y; y <= r.Y + r.Height; y++) { if (x > X - 4 && x < X + 4 && y > Y - 4 && y < Y + 4) continue; if (0.75 > Utility.RandomDouble()) { int id = Utility.RandomList(2282, 2273, 2277, 40106, 40107, 40108, 40106, 40107, 40108, 40106, 40107, 40108); Effects.SendLocationEffect(new Point3D(x, y, Map.GetAverageZ(x, y)), Map, id, 60); } } } IPooledEnumerable eable2 = Map.GetMobilesInBounds(r); foreach (Mobile m in eable2) { if (m.Alive && m is PlayerMobile && SpellHelper.ValidIndirectTarget(this, m) && CanBeHarmful(m, false)) { if (m.X > X - 4 && m.X < X + 4 && m.Y > Y - 4 && m.Y < Y + 4) continue; m.Freeze(TimeSpan.FromSeconds(2)); BleedAttack.BeginBleed(m, this, false); AOS.Damage(target, this, Utility.RandomMinMax(100, 110), 100, 0, 0, 0, 0); m.PrivateOverheadMessage(MessageType.Regular, 0x21, 1156849, m.NetState); // *Rising columns of rock rip through your flesh and concuss you!* } } eable2.Free(); } }
private SpellHelper GenerateValue() { var sh = new SpellHelper(); sh.BaseValue = GenerateBaseKey(); foreach (Mapping m in pnMapper.Children) { var b = new Bind(); b.BindedKey = ConvertTextToKey(m.Value); if (b.BindedKey == Keys.LControlKey) { return null; } for (int i = 0; i < 10; i++) { b.BindedValue[i] = m.GetMap(i); } sh.Binding.Add(b); } return sh; }
protected override void OnTarget(Mobile f, object o) { if (o is Item) { m_Owner.SendMessage("Visez le sol"); return; } if (!(o is IPoint3D)) { return; } IPoint3D p = o as IPoint3D; if (p != null) { SpellHelper.GetSurfaceTop(ref p); if (!m_Owner.CanSee(p)) { m_Owner.SendMessage("Vous ne voyez pas votre point de chute"); return; } if (Factions.Sigil.ExistsOn(m_Owner)) { m_Owner.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (Server.Misc.WeightOverloading.IsOverloaded(m_Owner)) { m_Owner.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!SpellHelper.CheckTravel(m_Owner, TravelCheckType.TeleportFrom)) { } else if (!SpellHelper.CheckTravel(m_Owner, m_Owner.Map, new Point3D(p), TravelCheckType.TeleportTo)) { } else if (m_Owner.Map == null || !m_Owner.Map.CanSpawnMobile(p.X, p.Y, p.Z)) { m_Owner.SendLocalizedMessage(501942); // That location is blocked. } else if (SpellHelper.CheckMulti(new Point3D(p), m_Owner.Map)) { m_Owner.SendLocalizedMessage(501942); // That location is blocked. } int hauteur = p.Z - m_Owner.Z; if (hauteur < 0) { hauteur = 0; } hauteur /= 5; int distance = (int)m_Owner.GetDistanceToSqrt(p); int diff = (10 + distance) + (hauteur); if (m_Owner.Stam < diff) { m_Owner.SendMessage("Trop loin, trop dur"); return; } Point3D from = m_Owner.Location; Point3D to = new Point3D(p); m_Owner.Stam -= diff; if (m_Owner.Competences[CompType.Saut].roll(diff)) { m_Owner.Emote("*Saute*"); m_Owner.Stam += diff / 2; m_Owner.Location = to; //m_Owner.ProcessDelta(); } else { m_Owner.Emote("*Essaie de sauter*"); m_Owner.Damage(6, null); m_Owner.SendMessage("Vous n'y arrivez pas"); } /* if (m_Owner.Player && m_Owner.Hidden == false) * { * Effects.SendLocationParticles(EffectItem.Create(from, m_Owner.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); * Effects.SendLocationParticles(EffectItem.Create(to, m_Owner.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); * } * else * { * m_Owner.FixedParticles( 0x376A, 9, 32, 0x13AF, EffectLayer.Waist ); * }*/ } }