public override void ReceiveDamage(Mobile from, int damage, BreakableStatic.InteractionType interactionType) { base.ReceiveDamage(from, damage, interactionType); double hitPointsPercent = (double)HitPoints / (double)MaxHitPoints; if (m_NextDamageStateNotification > 0.05 && hitPointsPercent < m_NextDamageStateNotification && DisplayName != "") { foreach (NetState state in NetState.Instances) { Mobile mobile = state.Mobile; PlayerMobile player = mobile as PlayerMobile; if (player == null) { continue; } if (UOACZRegion.ContainsMobile(player)) { player.SendMessage(UOACZSystem.yellowTextHue, "The " + DisplayName + " Stockpile is under attack and at " + Utility.CreatePercentageString(m_NextDamageStateNotification) + " durability."); } } m_NextDamageStateNotification -= NotificationInterval; } UOACZEvents.StockpileDamaged(false); }
public override bool OnDragDrop(Mobile from, Item dropped) { PlayerMobile player = from as PlayerMobile; if (player == null) { return(false); } if (!player.IsUOACZHuman) { return(false); } if (m_BoneCount >= UOACZSystem.HumanObjectiveBonesNeeded) { from.SendMessage("All the bones neccessary for this objective have been collected."); } if (!(dropped is Bone)) { from.SendMessage("Only bones may be placed in this container."); return(false); } int dropAmount = dropped.Amount; if ((m_BoneCount + dropAmount) > UOACZSystem.HumanObjectiveBonesNeeded) { dropAmount = UOACZSystem.HumanObjectiveBonesNeeded - m_BoneCount; dropped.Amount -= dropAmount; m_BoneCount += dropAmount; player.SendMessage("You deposit " + dropAmount.ToString() + " bones into the collection box. "); CheckScore(player, dropAmount); from.PlaySound(UOACZBoneBox.m_DropSound); UOACZEvents.CollectBones(); return(false); } CheckScore(player, dropAmount); m_BoneCount += dropAmount; player.PlaySound(UOACZBoneBox.m_DropSound); player.SendMessage("You deposit " + dropAmount.ToString() + " bones into the collection box. " + (UOACZSystem.HumanObjectiveBonesNeeded - m_BoneCount).ToString() + " more are needed to complete the warding ritual."); UOACZEvents.CollectBones(); return(true); }
public override void OnDamage(int amount, Mobile from, bool willKill) { base.OnDamage(amount, from, willKill); if (willKill) { UOACZEvents.UndeadChampionDamaged(true); } else { UOACZEvents.UndeadChampionDamaged(false); } }
public override void OnDamage(int amount, Mobile from, bool willKill) { base.OnDamage(amount, from, willKill); damageIntervalThreshold = (int)(Math.Round((double)HitsMax / (double)totalIntervals)); intervalCount = (int)(Math.Floor((1 - (double)Hits / (double)HitsMax) * (double)totalIntervals)); if (willKill) { UOACZEvents.HumanChampionDamaged(true); } else { UOACZEvents.HumanChampionDamaged(false); } }
public override void OnDeath(Container c) { base.OnDeath(c); if (m_Instances.Contains(this)) { m_Instances.Remove(this); } if (m_Spawner != null) { if (m_Spawner.m_Mobiles.Contains(this)) { m_Spawner.m_Mobiles.Remove(this); } } UOACZEvents.CivilianKilled(); }
protected override void OnTick() { if (m_RepairHammer == null || m_Player == null) { if (m_RepairHammer != null) { m_RepairHammer.m_Owner = null; } if (m_RepairHammer != null) { m_Player.EndAction(typeof(UOACZRepairHammer)); } Stop(); return; } if (m_RepairHammer.Deleted || m_Player.Deleted) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } List <UOACZBreakableStatic> m_NearbyBreakableStatics = GetNearbyBreakableStatics(m_Player); if (m_NearbyBreakableStatics.Count == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } UOACZBreakableStatic randomBreakableStatic = m_NearbyBreakableStatics[Utility.RandomMinMax(0, m_NearbyBreakableStatics.Count - 1)]; int repairableCount = 0; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { if (breakableStatic.CanRepair(m_Player, m_RepairHammer, 1.0, false)) { repairableCount++; } } if (repairableCount == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); m_Player.SendMessage("You stop making repairs."); Stop(); return; } if (m_RepairTicks == 0) { m_Player.BeginAction(typeof(BreakableStatic)); TimeSpan repairCooldown = TimeSpan.FromSeconds(RepairActionTickDuration.TotalSeconds * (double)RepairActionTicksNeeded); Timer.DelayCall(repairCooldown, delegate { if (m_Player != null) { m_Player.EndAction(typeof(BreakableStatic)); } }); } m_RepairTicks++; if (randomBreakableStatic.RepairSound != -1) { Effects.PlaySound(m_Player.Location, m_Player.Map, randomBreakableStatic.RepairSound); } m_Player.Animate(12, 5, 1, true, false, 0); m_Player.RevealingAction(); if (m_RepairTicks >= UOACZRepairHammer.RepairActionTicksNeeded) { m_RepairTicks = 0; int minRepairAmount = 40; int maxRepairAmount = 60; double baseRepairScalarBonus = 1.0; double carpentryScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double blacksmithingScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double tinkeringScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double bestScalar = 1; if (carpentryScalar > bestScalar) { bestScalar = carpentryScalar; } if (blacksmithingScalar > bestScalar) { bestScalar = blacksmithingScalar; } if (tinkeringScalar > bestScalar) { bestScalar = tinkeringScalar; } double repairValue = m_Player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.EmergencyRepairs); bestScalar += repairValue; bool outpostWasRepaired = false; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { int repairAmount = Utility.RandomMinMax(minRepairAmount, maxRepairAmount); repairAmount = (int)(Math.Round(((double)repairAmount * bestScalar))); if (breakableStatic.RequiresFullRepair) { BreakableStatic.DamageStateType damageState = breakableStatic.DamageState; breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); if (breakableStatic.HitPoints < breakableStatic.MaxHitPoints) { breakableStatic.DamageState = damageState; } else { breakableStatic.DamageState = BreakableStatic.DamageStateType.Normal; } } else { breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TotalRepairAmount += repairAmount; m_Player.SendMessage("You repair an object for " + repairAmount.ToString() + " hitpoints."); if (UOACZPersistance.m_OutpostComponents.Contains(breakableStatic)) { outpostWasRepaired = true; UOACZEvents.RepairOutpostComponent(); } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TimesRepaired++; bool scored = false; double scoreChance = UOACZSystem.HumanRepairScoreChance; if (outpostWasRepaired) { scoreChance += UOACZSystem.HumanOutpostRepairScoreChance; } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairScoreChance) { UOACZSystem.ChangeStat(m_Player, UOACZSystem.UOACZStatType.HumanScore, 1, true); scored = true; } if (m_Player.Backpack != null) { if (Utility.RandomDouble() <= UOACZSystem.HumanRepairSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZSurvivalStone(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for your repair efforts!"); } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZHumanUpgradeToken(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for your repair efforts!"); } } m_RepairHammer.Charges--; if (m_RepairHammer.Charges <= 0) { m_RepairHammer.Delete(); } } }
public virtual void TurnCorrupted(Mobile from) { if (!UOACZSystem.IsUOACZValidMobile(from)) { return; } if (Corrupted) { return; } if (from is PlayerMobile) { PlayerMobile player = from as PlayerMobile; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.WildlifeCorrupted++; } UOACZEvents.SpreadCorruption(); Combatant = null; Aggressed.Clear(); Aggressors.Clear(); Warmode = false; m_Corrupted = true; Hue = CorruptHue; Name = CorruptedName; CorpseNameOverride = CorruptedCorpseName; PublicOverheadMessage(MessageType.Regular, 2210, false, "*becomes corrupted*"); Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2530, 0, 2023, 0); TimedStatic greenGoo = new TimedStatic(0x122D, 5); greenGoo.Name = "corruption"; greenGoo.Hue = 2530; greenGoo.MoveToWorld(Location, Map); PlaySound(GetAngerSound()); PlaySound(0x62B); for (int a = 0; a < 4; a++) { greenGoo = new TimedStatic(Utility.RandomList(4651, 4652, 4653, 4654), 5); greenGoo.Name = "corruption"; greenGoo.Hue = 2530; Point3D targetLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Y); SpellHelper.AdjustField(ref targetLocation, Map, 12, false); greenGoo.MoveToWorld(targetLocation, Map); } SetCorruptAI(); DamageMin = (int)(Math.Round((double)DamageMin * CorruptedDamageScalar)); DamageMax = (int)(Math.Round((double)DamageMax * CorruptedDamageScalar)); AttackSpeed = (int)(Math.Round((double)AttackSpeed * CorruptedAttackSpeedScalar)); Skills.Wrestling.Base *= CorruptedWrestlingScalar; }
public override void BeforeBreak(Mobile from, InteractionType interactionType) { UOACZEvents.SourceOfCorruptionDamaged(true); }
public override void AfterBreak(Mobile from, BreakableStatic.InteractionType interactionType) { base.AfterBreak(from, interactionType); UOACZEvents.StockpileDamaged(true); }
public override void AfterReceiveDamage(Mobile from, int damage, InteractionType interactionType) { base.AfterReceiveDamage(from, damage, interactionType); PlayerMobile player = from as PlayerMobile; if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.TotalObjectDamage++; } if (this is UOACZCorruptionSourcestone) { UOACZEvents.SourceOfCorruptionDamaged(false); if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZHuman) { if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneScoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, 1, true); } if (player.Backpack != null) { if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar) { player.Backpack.DropItem(new UOACZSurvivalStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for damaging the corruption sourcestone!"); } if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar) { player.Backpack.DropItem(new UOACZHumanUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for damaging the corruption sourcestone!"); } } } } } else if (this is UOACZStockpile) { if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZUndead) { if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileScoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true); } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZCorruptionStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone for damaging a stockpile!"); } } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token for damaging a stockpile!"); } } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileRewardChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZBrains()); player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for damaging a stockpile!"); } } } } } else { if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZUndead) { bool outpostObject = false; if (UOACZPersistance.m_OutpostComponents.Contains(this)) { outpostObject = true; } double scoreChance = UOACZSystem.UndeadDamageObjectScoreChance; double corruptionChance = UOACZSystem.UndeadDamageObjectCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar; double upgradeChance = UOACZSystem.UndeadDamageObjectUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar; double rewardChance = UOACZSystem.UndeadDamageObjectRewardChance * UOACZPersistance.UndeadBalanceScalar; if (outpostObject) { scoreChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; corruptionChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; upgradeChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; rewardChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; if (UOACZPersistance.m_HumanObjective1 == UOACZPersistance.m_HumanObjective1Target) { scoreChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; corruptionChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; upgradeChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; rewardChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; } } if (Utility.RandomDouble() <= scoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true); } if (player.Backpack != null) { if (Utility.RandomDouble() <= corruptionChance) { player.Backpack.DropItem(new UOACZCorruptionStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned a corruption stone for destruction!"); } if (Utility.RandomDouble() <= upgradeChance) { player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for destruction!"); } if (Utility.RandomDouble() <= rewardChance) { player.Backpack.DropItem(new UOACZBrains()); player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for destruction."); } } } } } }