public void Undo() { for (int i = 0; i < _damageTargets.Count; ++i) { DamageEntry entry = _damageTargets[i]; CombatData data = entry.Entity; int dmgAmount = entry.damageAmount; if (entry.previousTempHP > 0) { int num = Math.Min(entry.previousTempHP, entry.damageAmount); data.TempHP += num; dmgAmount -= num; } if (dmgAmount > 0) { data.Damage -= dmgAmount; } //this.fLog.AddDamageEntry(pair2.First.ID, damage, damageForm.Types); //TODO: If the creature state changes the log it //CreatureState creatureState = _encounter.GetState(data); //this.fLog.AddStateEntry(pair2.First.ID, creatureState); } }
private static List <Mobile> GetKillerList(IList <DamageEntry> damageEntries) { List <Mobile> killerList = new List <Mobile>(); //Get a list of the killers involved for (int i = damageEntries.Count - 1; i >= 0; --i) { if (i >= damageEntries.Count) { continue; } DamageEntry de = damageEntries[i]; if (de.HasExpired || killerList.Contains(de.Damager)) { damageEntries.RemoveAt(i); continue; } killerList.Add(de.Damager); } return(killerList); }
public void AddDamageUI(CombotPart part) { if (!damageList.IsDamageListFull) { DamageEntry entry = damageList.AddEntry(part.name); part.AddDamageMarker(entry); } }
public override void OnDeath(Container c) { #region Gives gold and Faction coin based on alignment List <DamageEntry> rights = DamageEntries; List <Mobile> toGiveGold = new List <Mobile>(); List <Mobile> toGiveItem = new List <Mobile>(); List <Mobile> toRemove = new List <Mobile>(); List <int> GoldToRecieve = new List <int>(); for (int i = 0; i < rights.Count; ++i) { DamageEntry de = rights[i]; //Only players get rewarded if (de.HasExpired || !de.Damager.Player) { DamageEntries.RemoveAt(i); continue; } toGiveGold.Add(de.Damager); GoldToRecieve.Add(de.DamageGiven * 3); //Player gets 3 times the damage dealt in gold if (de.DamageGiven > 50) //Players doing more than 50 damage they get an order coin { toGiveItem.Add(de.Damager); } } foreach (Mobile m in toGiveGold) { if (m is PlayerMobile) { int amountofgold = GoldToRecieve[toGiveGold.IndexOf(m)]; if (amountofgold > 1000) { amountofgold = 1000; } m.AddToBackpack(new Gold(amountofgold)); } } foreach (Mobile m in toGiveItem) { ChaosCoin item = new ChaosCoin(); if (m is PlayerMobile && m.Guild.Type == GuildType.Chaos) { m.AddToBackpack(item); m.SendAsciiMessage("You have been rewarded a Chaos Coin for fighting for Lord Blackthorn."); } } #endregion }
public void AddDamage(HitInfo info) { DamageEntry entry; if (!damageEntries.TryGetValue(info.InitiatorPlayer.userID, out entry)) { damageEntries[info.InitiatorPlayer.userID] = entry = new DamageEntry(); } entry.AddDamage(info.damageTypes.Total()); }
public static bool IsEthicsDeath(Mobile from) { Player fromState = Player.Find(from); if (fromState.HasFallen) //Fallen heroes/evils get no rights. { return(false); } Ethic fromEthic = fromState.Ethic; int ethicdamage = 0; int nonethicdamage = 0; for (int i = from.DamageEntries.Count - 1; i >= 0; --i) { if (i >= from.DamageEntries.Count) { continue; } DamageEntry de = from.DamageEntries[i]; if (de.HasExpired) { from.DamageEntries.RemoveAt(i); } else if (de.Damager != from) { Ethic ethic = Ethic.Find(de.Damager); if (ethic != null && ethic != fromEthic) { if (i == from.DamageEntries.Count - 1) { return(true); //Most recent damager } ethicdamage += de.DamageGiven; } else { nonethicdamage += de.DamageGiven; } } } return(ethicdamage > nonethicdamage); //At least 50% ethic damage }
public virtual void RegisterDamageTo(Mobile m) { if (m == null) { return; } for (var index = 0; index < m.DamageEntries.Count; index++) { DamageEntry de = m.DamageEntries[index]; Mobile damager = de.Damager; Mobile master = damager.GetDamageMaster(m); if (master != null) { damager = master; } RegisterDamage(damager, de.DamageGiven); } }
public override bool DoActionCombat() { Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; if (c == null || c.Deleted || !c.Alive || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name); m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else { m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard."); Action = ActionType.Wander; return(true); } } if (!m_Mobile.InLOS(c)) { if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } } if (!m_Mobile.InRange(c, m_Mobile.RangePerception)) { // They are somewhat far away, can we find something else? if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3)) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; if (c == null) { m_Mobile.DebugSay("My combatant has fled, so I am on guard"); Action = ActionType.Wander; return(true); } } if (m_Mobile.CheckFlee() && TeleHides > 0) { m_Mobile.DebugSay("I am going to flee from {0}", c.Name); Action = ActionType.Flee; return(true); } if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, 12)) { // We are ready to cast a spell if (c.Combatant != m_Mobile) { DamageEntry de = m_Mobile.FindDamageEntryFor(c); if (de == null || de.HasExpired) { de = c.FindDamageEntryFor(m_Mobile); if ((de == null || de.HasExpired)) { if (!NotorietyHandlers.CheckAggressor(m_Mobile.Aggressors, c) && !NotorietyHandlers.CheckAggressed(c.Aggressed, m_Mobile)) { // we cant cast because the player didnt hit us yet RunTo(c); return(true); } } } } Spell spell = null; Mobile toDispel = FindDispelTarget(true); if (m_Combo != -1) // We are doing a spell combo { spell = DoCombo(c); } else { spell = GetRandomDamageSpell(toDispel != null); } // Now we have a spell picked // Move first before casting if (toDispel != null) { if (m_Mobile.InRange(toDispel, 5)) { RunFrom(toDispel); } else if (!m_Mobile.InRange(toDispel, 11)) { RunTo(toDispel); } } else { RunTo(c); } if (spell != null && spell.Cast()) { TimeSpan delay; if (spell is DispelSpell) { delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed); } else { delay = spell.GetCastDelay() + TimeSpan.FromSeconds(Utility.Random(3)); } m_NextCastTime = DateTime.Now + delay; } } else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting) { RunTo(c); } return(true); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, 10)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Tamer.SendLocalizedMessage(1049654); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (m_Creature.IsHenchman) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (!m_Creature.Tameable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = Core.TickCount; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } double minSkill = m_Creature.MinTameSkill; //TEST: CHECK THIS FOR BALANCE PURPOSES if (m_Creature.Owners.Count > 0) { minSkill += 25; } //Check for Skillgain (Success Chance Calculated Separately) if (!alreadyOwned) { m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill, minSkill + 25.0, 1.0); m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0, 1.0); } double successChance = 0; double chanceResult = Utility.RandomDouble(); successChance = (m_Tamer.Skills[SkillName.AnimalTaming].Value - m_Creature.MinTameSkill) * .04; if (m_Tamer.Skills[SkillName.AnimalTaming].Value == m_Creature.MinTameSkill) { successChance = 0.01; } var pmTamer = m_Tamer as PlayerMobile; if (alreadyOwned || chanceResult <= successChance) { if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.TimesTamed++; m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; m_Creature.OwnerAbandonTime = DateTime.UtcNow + m_Creature.AbandonDelay; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
public override bool DoActionCombat() { Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; if (c == null || c.Deleted || !c.Alive || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false)) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name); m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else { m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard."); Action = ActionType.Wander; return(true); } } if (!m_Mobile.InLOS(c)) { if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } } //if ( SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0 ) // EventSink.InvokeStunRequest( new StunRequestEventArgs( m_Mobile ) ); if (!m_Mobile.InRange(c, m_Mobile.RangePerception)) { // They are somewhat far away, can we find something else? if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else //if ( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) ) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; if (c == null) { m_Mobile.DebugSay("My combatant has fled, so I am on guard"); Action = ActionType.Wander; return(true); } } if (m_Mobile.CheckFlee()) { // We are low on health, should we flee? bool flee = flee = Utility.Random(0, 100) < 90; // 90% chance to flee if (flee) { m_Mobile.DebugSay("I am going to flee from {0}", c.Name); Action = ActionType.Flee; return(true); } } if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, 12) && m_Mobile.InLOS(c)) { // We are ready to cast a spell // This was on Rebirth. Maybe we should remove it? DamageEntry de = m_Mobile.FindDamageEntryFor(c); if (de == null || de.HasExpired) { de = c.FindDamageEntryFor(m_Mobile); if ((de == null || de.HasExpired)) { if (!NotorietyHandlers.CheckAggressor(m_Mobile.Aggressors, c) && !NotorietyHandlers.CheckAggressed(c.Aggressed, m_Mobile)) { // we cant cast because we didnt give or take damage yet RunTo(c); return(true); } } } Spell spell = null; Mobile toDispel = FindDispelTarget(true); if (SmartAI && m_Combo != -1) // We are doing a spell combo { spell = DoCombo(c); } else { spell = GetRandomDamageSpell(toDispel != null); } // Now we have a spell picked // Move first before casting if (SmartAI && toDispel != null) { if (m_Mobile.InRange(toDispel, 5)) { RunFrom(toDispel); } else if (!m_Mobile.InRange(toDispel, 11)) { RunTo(toDispel); } } else { RunTo(c); } if (spell != null && spell.Cast()) { TimeSpan delay; if (spell is DispelSpell) { delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed * 2.0); } else { delay = spell.GetCastDelay() + TimeSpan.FromSeconds(0.5 + Utility.RandomMinMax(0, 2)); } m_NextCastTime = DateTime.Now + delay; } } else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting) { RunTo(c); } return(true); }
public bool HasExpired(DamageEntry de) { return(de.LastDamage + TimeSpan.FromMinutes(5.0) < DateTime.Now); }
public void RemoveDamageMarker(DamageEntry entry) { damageEntries.Remove(entry); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = (m_Creature.LastOwner == m_Tamer); if (!m_Tamer.InRange(m_Creature, 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(502795)); // You are too far away to continue taming. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(502796)); // You are dead, and cannot continue taming. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature))// || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(1049654)); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(1049655)); // That creature cannot be tamed. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(502804)); // That animal looks tame already. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(1005615)); // This animal has had too many owners and is too upset for you to tame. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(1054025)); // You must subdue this creature before you can tame it! Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendAsciiMessage(CliLoc.LocToString(502794)); // The animal is too angry to continue taming. Stop(); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); string msg = ""; switch (Utility.Random(4)) { case 0: if (!string.IsNullOrEmpty(m_Creature.Name)) { msg = string.Format("I always wanted a {0} like you.", m_Creature.Name); } else { msg = CliLoc.LocToString(502790); } break; case 1: if (!string.IsNullOrEmpty(m_Creature.Name)) { msg = string.Format("Good {0}.", m_Creature.Name); } else { msg = CliLoc.LocToString(1005608); } break; case 2: if (!string.IsNullOrEmpty(m_Creature.Name)) { msg = string.Format("Here {0}.", m_Creature.Name); } else { msg = CliLoc.LocToString(1010593); } break; case 3: if (!string.IsNullOrEmpty(m_Creature.Name)) { msg = string.Format("I won't hurt you"); } else { msg = CliLoc.LocToString(1010593); } break; } SpellHelper.Turn(m_Tamer, m_Creature); m_Tamer.PublicOverheadMessage(MessageType.Regular, 906, true, msg); if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.Now; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill; //+ (m_Creature.Owners.Count * 6.0); Taran - Same chance to tame no matter how many owners the mount has had if (minSkill > -29.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -29.9; // 50% at 0.0? } double tamerSkill = m_Tamer.Skills[SkillName.AnimalTaming].Value; if (minSkill > tamerSkill) //Taran - Adding chance to tame and gain even if you have lower Animal Taming than MinTameSkill { if (minSkill - tamerSkill <= 5) //1% chance to tame when less than 5% difference in taming and mintameskill { minSkill = tamerSkill + 19.3; } else if (minSkill - tamerSkill <= 10) //0.5% chance to tame when less than 10% difference in taming and mintameskill { minSkill = tamerSkill + 19.65; } else if (minSkill - tamerSkill <= 20) //0.25% chance to tame when less than 20% difference in taming and mintameskill { minSkill = tamerSkill + 19.825; } else if (minSkill - tamerSkill > 20) //0.1% chance to tame when more than 20% difference in taming and mintameskill { minSkill = tamerSkill + 19.93; } } //Taran - Changed the chance to tame below if (alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 20.0, minSkill + 50.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { //m_Tamer.SendLocalizedMessage( 502797 ); // That wasn't even challenging. m_Tamer.SendAsciiMessage("{0} remembers you and accepts you once more as its master.", m_Creature.Name); if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else { if (m_Creature.Controlled && m_Creature.ControlMaster != null) { m_Tamer.SendAsciiMessage("Someone else tamed that creature before you."); } else { m_Tamer.SendAsciiMessage(CliLoc.LocToString(502799)); //m_Tamer.SendAsciiMessage("The {0} accepts you as its master.", m_Creature); m_Creature.Owners.Add(m_Tamer); } } if (!m_Creature.Controlled && m_Creature.ControlMaster == null) { //m_Tamer.SendAsciiMessage("The {0} accepts you as its master.", m_Creature.Name); m_Creature.SetControlMaster(m_Tamer); } else { m_Tamer.SendAsciiMessage("Someone else tamed that creature before you."); } m_Creature.IsBonded = false; if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } else { m_Tamer.SendAsciiMessage(CliLoc.LocToString(502798)); // You fail to tame the creature. if (m_Tamer is PlayerMobile) { ((PlayerMobile)m_Tamer).EndPlayerAction(); } } } }
public override bool OnBeforeDeath() { if (m_TrueForm) { #region Taran: Reward all attackers List <DamageEntry> rights2 = DamageEntries; List <Mobile> toGiveGold = new List <Mobile>(); List <Mobile> toGiveItem = new List <Mobile>(); List <Mobile> toRemove = new List <Mobile>(); List <int> GoldToRecieve = new List <int>(); for (int i = 0; i < rights2.Count; ++i) { DamageEntry de = rights2[i]; //Only players get rewarded if (de.HasExpired || !de.Damager.Player) { DamageEntries.RemoveAt(i); continue; } toGiveGold.Add(de.Damager); GoldToRecieve.Add(de.DamageGiven * 10); //Player gets 10 times the damage dealt in gold if (de.DamageGiven > 1000) //Players doing more than 1000 damage gets a random weapon or armor { toGiveItem.Add(de.Damager); } } foreach (Mobile m in toGiveGold) { if (m is PlayerMobile) { int amountofgold = GoldToRecieve[toGiveGold.IndexOf(m)]; if (amountofgold > 100000) { amountofgold = 100000; //Taran: Could be good with a max of 100k if damage bugs occur } if (amountofgold > 65000) { m.AddToBackpack(new BankCheck(amountofgold)); } else { m.AddToBackpack(new Gold(amountofgold)); } m.SendAsciiMessage("You dealt {0} damage to the champion and got {1} gold", amountofgold / 10, amountofgold); } } foreach (Mobile m in toGiveItem) { if (m is PlayerMobile) { Item item = Loot.RandomArmorOrShieldOrWeapon(); if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6); armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); } m.AddToBackpack(item); m.SendAsciiMessage("You dealt more than 1000 damage to the harrower, your reward is well deserved!"); } } //Remove all monsters within 20 tiles when the harrower is killed foreach (Mobile m in Map.GetMobilesInRange(Location, 20)) { if (m is BaseCreature && !(m is Harrower)) { BaseCreature bc = (BaseCreature)m; if (!(m is BaseMount) && m.Spawner == null && bc.LastOwner == null && !bc.Controlled) { toRemove.Add(m); } } } foreach (Mobile m in toRemove) { if (m != null) { m.Delete(); } } #endregion List <DamageStore> rights = GetLootingRights(DamageEntries, HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight && ds.m_Mobile is PlayerMobile) { PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile); } } if (!NoKillAwards) { //GivePowerScrolls(); Map map = Map; if (map != null) { for (int x = -16; x <= 16; ++x) { for (int y = -16; y <= 16; ++y) { double dist = Math.Sqrt(x * x + y * y); if (dist <= 16) { new GoodiesTimer(map, X + x, Y + y).Start(); } } } } for (int i = 0; i < m_Tentacles.Count; ++i) { Mobile m = m_Tentacles[i]; if (!m.Deleted) { m.Kill(); } } m_Tentacles.Clear(); if (m_GateItem != null) { m_GateItem.Delete(); } } return(base.OnBeforeDeath()); } else { Morph(); return(false); } }
private void GiveMagicItems() { ArrayList toGive = new ArrayList(); LogHelper Logger = new LogHelper("HarrowerLoot.log", false); ArrayList allNonExpiredPMDamageEntries = new ArrayList(); //New Looting method (Pix: 4/8/06) for (int i = 0; i < DamageEntries.Count; i++) { DamageEntry de = DamageEntries[i] as DamageEntry; if (de != null) { Logger.Log(LogType.Text, string.Format("DE[{0}]: {1} ({2})", i, de.Damager, de.Damager != null ? de.Damager.Name : "")); if (de.HasExpired) { Logger.Log(LogType.Text, string.Format("DE[{0}]: Expired", i)); } else { if (de.Damager != null && !de.Damager.Deleted) { if (de.Damager is BaseCreature) { Logger.Log(LogType.Text, string.Format("DE[{0}]: BaseCreature", i)); BaseCreature bc = (BaseCreature)de.Damager; if (bc.ControlMaster != null && !bc.ControlMaster.Deleted) { //de.Damager = bc.ControlMaster; DamageEntry cmde = new DamageEntry(bc.ControlMaster); cmde.DamageGiven = de.DamageGiven; de = cmde; Logger.Log(LogType.Text, string.Format("DE[{0}]: New Damager: {1}", i, de.Damager.Name)); } } if (de.Damager is PlayerMobile) { Logger.Log(LogType.Text, string.Format("DE[{0}]: PlayerMobile", i)); if (de.Damager.Alive) { Logger.Log(LogType.Text, string.Format("DE[{0}]: PM Alive", i)); bool bFound = false; for (int j = 0; j < allNonExpiredPMDamageEntries.Count; j++) { DamageEntry de2 = (DamageEntry)allNonExpiredPMDamageEntries[j]; if (de2.Damager == de.Damager) { Logger.Log(LogType.Text, string.Format("DE[{0}]: PM Found, adding damage", i)); de2.DamageGiven += de.DamageGiven; bFound = true; break; } } if (!bFound) { Logger.Log(LogType.Text, string.Format("DE[{0}]: PM not found, adding", i)); allNonExpiredPMDamageEntries.Add(de); } } } } } } } //Remove any PMs that are over 100 tiles away ArrayList toRemove = new ArrayList(); for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++) { DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i]; if (de.Damager.GetDistanceToSqrt(this.Location) > 100) { Logger.Log(LogType.Text, string.Format("Removing {0} for being too far away at death", de.Damager.Name)); toRemove.Add(allNonExpiredPMDamageEntries[i]); } } for (int i = 0; i < toRemove.Count; i++) { allNonExpiredPMDamageEntries.Remove(toRemove[i]); } int topDamage = 0; int minDamage = 0; for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++) { DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i]; if (de.DamageGiven > topDamage) { topDamage = de.DamageGiven; } Logger.Log(LogType.Text, string.Format("Non-Expired[{0}]: {1} (damage: {2})", i, de.Damager.Name, de.DamageGiven)); } //Now filter on 'enough' damage if (HitsMax >= 3000) { minDamage = topDamage / 16; } else if (HitsMax >= 1000) { minDamage = topDamage / 8; } else if (HitsMax >= 200) { minDamage = topDamage / 4; } else { minDamage = topDamage / 2; } Logger.Log(LogType.Text, string.Format("HitsMax: {0}, TopDamage: {1}, MinDamage: {2}", HitsMax, topDamage, minDamage)); for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++) { DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i]; if (de.DamageGiven >= minDamage) { toGive.Add(de.Damager); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); object hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } Logger.Log(LogType.Text, ""); // new line Logger.Log(LogType.Text, "Randomized list of players:"); for (int i = 0; i < toGive.Count; ++i) { Mobile mob = toGive[i] as Mobile; Logger.Log(LogType.Mobile, mob, "alive:" + mob.Alive.ToString()); } Logger.Log(LogType.Text, ""); // new line Logger.Log(LogType.Text, "Begin loot distribution: Who/What:"); // Loop goes until we've generated MaxGifts items. for (int i = 0; i < MaxGifts; ++i) { Item reward = null; Mobile m = (Mobile)toGive[i % toGive.Count]; switch (Utility.Random(10)) { case 0: // Power/Vanq Weapon case 1: case 2: // 3 in 10 chance { // 33% chance at best reward = CreateWeapon((0.32 >= Utility.RandomDouble()) ? 5 : 4); break; } case 3: // Fort/Invul Armor case 4: case 5: // 3 in 10 chance { // 33% chance at best reward = CreateArmor((0.32 >= Utility.RandomDouble()) ? 5 : 4); break; } case 6: // hair/beard dye { // 1 in 10 chance if (Utility.RandomBool()) { reward = new SpecialHairDye(); } else { reward = new SpecialBeardDye(); } break; } case 7: // special cloth { // 1 in 10 chance reward = new UncutCloth(50); if (Utility.RandomBool()) { // best ore hues (vet rewards) + really dark 'evil cloth' reward.Hue = Utility.RandomList(2213, 2219, 2207, 2425, 1109); } else { reward.Hue = 0x01; // black cloth } break; } case 8: // potted plant { // 1 in 10 chance switch (Utility.Random(11)) { default: // should never happen case 0: reward = new PottedCactus(); break; case 1: reward = new PottedCactus1(); break; case 2: reward = new PottedCactus2(); break; case 3: reward = new PottedCactus3(); break; case 4: reward = new PottedCactus4(); break; case 5: reward = new PottedCactus5(); break; case 6: reward = new PottedPlant(); break; case 7: reward = new PottedPlant1(); break; case 8: reward = new PottedPlant2(); break; case 9: reward = new PottedTree(); break; case 10: reward = new PottedTree1(); break; } break; } default: // Should never happen /* fall through*/ case 9: // Magic Item Drop { // 1 in 10 chance reward = Loot.RandomClothingOrJewelry(); if (reward != null) { int minLevel = 3; int maxLevel = 3; if (reward is BaseClothing) { ((BaseClothing)reward).SetRandomMagicEffect(minLevel, maxLevel); } else if (reward is BaseJewel) { ((BaseJewel)reward).SetRandomMagicEffect(minLevel, maxLevel); } } break; } } if (reward != null) { // Drop the new weapon into their backpack and send them a message. m.SendMessage("You have received a special item!"); m.AddToBackpack(reward); Logger.Log(LogType.Mobile, m, "alive:" + m.Alive.ToString()); Logger.Log(LogType.Item, reward, string.Format("Hue:{0}:Rare:{1}", reward.Hue, (reward is BaseWeapon || reward is BaseArmor || reward is BaseClothing || reward is BaseJewel) ? "False" : "True")); } } // done logging Logger.Finish(); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, 6)) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature)) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049654, m_Tamer.NetState); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { ; m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } //XP Gain m_Tamer.GiveXP(5); if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.Now; if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (alreadyOwned || m_Tamer.Competences[CompType.Dressage].roll(m_Creature.DressageDD)) { if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
private bool RemoveEntry(out DamageEntry entry) { return(Entries.TryDequeue(out entry)); }
private void AddEntry(DamageEntry entry) { Entries.Enqueue(entry); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, Core.AOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous vous êtes trop éloigné pour continuer de l'apprivoiser", m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous êtes morts et ne pouvez donc continuer de l'apprivoiser", m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Tamer.SendMessage("Vous n'arrivez pas à suivre l'animal et devez donc cesser de l'apprivoiser"); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cette créature ne peut être apprivoisée", m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a déjà un maître", m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a eu suffisamment de maître dans le passé et souhaite qu'on le laisse tranquille", m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous devez assujetir cette créature avant de l'apprivoiser", m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal est trop irrité pour être apprivoisé", m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.Now; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Creature is GreaterDragon) { ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90% m_Creature.Skills[SkillName.Magery].Base = m_Creature.Skills[SkillName.Magery].Cap; // Greater dragons have a 90% cap reduction and 90% skill reduction on magery } else if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendMessage("L'animal vient instinctivement près de vous"); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Il semble vous accepter comme maître", m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "L'animal refuse de vous laisser approcher", m_Tamer.NetState); // You fail to tame the creature. } } }
public override bool OnBeforeDeath(Mobile m) { if (m is DespiseCreature despiseCreature && despiseCreature.Region != null && despiseCreature.Region.IsPartOf(GetType()) && !despiseCreature.Controlled && despiseCreature.Orb == null) { Dictionary <DespiseCreature, int> creatures = new Dictionary <DespiseCreature, int>(); for (var index = 0; index < despiseCreature.DamageEntries.Count; index++) { DamageEntry de = despiseCreature.DamageEntries[index]; if (de.Damager is DespiseCreature creat) { if (!creat.Controlled || creat.Orb == null) { continue; } if (creatures.ContainsKey(creat)) { creatures[creat] += de.DamageGiven; } else { creatures[creat] = de.DamageGiven; } } } if (creatures.Count > 0) { DespiseCreature topdam = null; int highest = 0; foreach (KeyValuePair <DespiseCreature, int> kvp in creatures) { if (topdam == null || kvp.Value > highest) { topdam = kvp.Key; highest = kvp.Value; } } if (topdam != null && highest > 0) { int mobKarma = Math.Abs(despiseCreature.Karma); int karma = (int)((double)mobKarma / 10 * highest / despiseCreature.HitsMax); if (karma < 1) { karma = 1; } if (despiseCreature.Karma > 0) { karma *= -1; } Mobile master = topdam.GetMaster(); Alignment oldAlign = topdam.Alignment; int power = topdam.Power; topdam.Karma += karma; Alignment newAlign = topdam.Alignment; if (master != null && karma > 0) { master.SendLocalizedMessage(1153281); // Your possessed creature has gained karma! } else if (master != null && karma < 0) { master.SendLocalizedMessage(1153282); // Your possessed creature has lost karma! } if (power < topdam.MaxPower) { topdam.Progress += despiseCreature.Power; if (topdam.Power > power && master != null) { master.SendLocalizedMessage(1153294, topdam.Name); // ~1_NAME~ has achieved a new threshold in power! } } else if (master != null) { master.SendLocalizedMessage(1153309); // Your controlled creature cannot gain further power. } if (oldAlign != newAlign && newAlign != Alignment.Neutral && topdam.MaxPower < 15) { topdam.MaxPower = 15; if (master != null) { master.SendLocalizedMessage(1153293, topdam.Name); // ~1_NAME~ is growing in strength. } topdam.Delta(MobileDelta.Noto); topdam.FixedEffect(0x373A, 10, 30); topdam.PlaySound(0x209); } if (master != null && master.Map != null && master.Map != Map.Internal && master.Backpack != null) { PutridHeart heart = new PutridHeart(Utility.RandomMinMax(despiseCreature.Power * 8, despiseCreature.Power * 10)); if (!master.Backpack.TryDropItem(master, heart, false)) { heart.MoveToWorld(master.Location, master.Map); } } } } } return(base.OnBeforeDeath(m)); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away to continue taming.", m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are dead, and cannot continue taming.", m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have a clear path to the animal you are taming, and must cease your attempt.", m_Tamer.NetState); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "That creature cannot be tamed.", m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "That animal looks tame already.", m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "This animal has had too many owners and is too upset for you to tame.", m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You must subdue this creature before you can tame it!", m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.Now; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The animal is too angry to continue taming.", m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); string name = m_Creature.Name.ToString(); name = name.Replace("a ", ""); name = name.Replace("an ", ""); switch (Utility.Random(9)) { case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Here {0}.", name)); break; case 3: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Nice {0}.", name)); break; case 5: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Good {0}.", name)); break; case 7: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "I've always wanted a pet like you."); break; case 8: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Don't be afraid."); break; case 9: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "I won't hurt you."); break; } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.Now; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } if (Core.SE) { AdjustSkillCaps(m_Creature); } } if (alreadyOwned) { m_Tamer.SendAsciiMessage("That wasn't even challenging."); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "It seems to accept you as master.", m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You fail to tame the creature.", m_Tamer.NetState); // You fail to tame the creature. } } }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, m_Creature.EraAOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Tamer.SendLocalizedMessage(1049654); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { Skill tskill = m_Tamer.Skills[SkillName.AnimalLore]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); tskill = m_Tamer.Skills[SkillName.AnimalTaming]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.UtcNow; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Creature is GreaterDragon) { ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90% m_Creature.Skills[SkillName.Magery].Base = m_Creature.Skills[SkillName.Magery].Cap; // Greater dragons have a 90% cap reduction and 90% skill reduction on magery } else if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; m_Creature.Combatant = null; m_Creature.Warmode = false; if (!alreadyOwned) { Conquests.CheckProgress <CreatureTamingConquest>(m_Tamer as PlayerMobile, m_Creature); } Conquests.CheckProgress <ObtainConquest>(m_Tamer as PlayerMobile, m_Creature); m_Creature.ControlOrder = OrderType.Follow; m_Creature.ControlTarget = m_Tamer; DiscordanceInfo info = Discordance.GetDiscord(m_Creature); if (info != null && info.From == m_Tamer) { info.Ending = true; info.EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(15); } } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
public DamageEntry AddEntry(string fullName) { string partName = "Head"; if (fullName.ToLower().Contains("arm")) { if (fullName.ToLower().Contains("left")) { partName = "Left Arm"; } else { partName = "Right Arm"; } } else if (fullName.ToLower().Contains("head")) { partName = "Head"; } else if (fullName.ToLower().Contains("leg")) { if (fullName.ToLower().Contains("left")) { partName = "Left Leg"; } else { partName = "Right Leg"; } } else if ( fullName.ToLower().Contains("hips") || fullName.ToLower().Contains("torso")) { partName = "Torso"; } GameObject obj = Instantiate( gameManager.GetPrefab("DamageUIEntry"), transform); DamageEntry entry = obj.GetComponent <DamageEntry>(); string component = partName.ToLower().Contains("head") ? headComponents[Random.Range(0, headComponents.Count)] : genericComponents[Random.Range(0, genericComponents.Count)]; string damageText = string.Format( "{0} {1} on {2}", damageDescriptions[Random.Range(0, damageDescriptions.Count)], component, partName ).ToLower(); entry.Text = damageText.First().ToString().ToUpper() + damageText.Substring(1); RectTransform part; switch (partName) { case "Head": part = headArea; break; case "LeftArm": part = leftArmArea; break; case "RightArm": part = rightArmArea; break; case "LeftLeg": part = leftLegArea; break; case "RightLeg": part = rightLegArea; break; default: part = torsoArea; break; } entry.Marker.transform.SetParent(part.transform); Vector2 pos = new Vector2( Random.Range(0, headArea.sizeDelta.x), Random.Range(0, -headArea.sizeDelta.y) ); entry.Marker.anchoredPosition = pos; return(entry); }
protected override void OnTick() { m_Count++; if (isCreature) { DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_From); if (!m_From.InRange(m_Creature, 6)) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away to continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are dead, and cannot continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_Creature.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The creature is dead, so you cannot continue hypnotizing it.", m_From.NetState); Stop(); } else if (m_Creature.Controlled && m_Creature.ControlMaster == m_From) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The creature will already obey you.", m_From.NetState); Stop(); } else if (!m_From.CanSee(m_Creature) || !m_From.InLOS(m_Creature)) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have a clear path to the creature you are hypnotizing, and must cease your attempt.", m_From.NetState); Stop(); } else if (m_Creature.Frozen && m_Creature.Paralyzed) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "It appears to be already in a trance.", m_From.NetState); Stop(); } else if (m_Count < m_FullCount) { m_From.RevealingAction(); switch (Utility.Random(5)) { case 0: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "You are getting sleepy....", false); break; case 1: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look into my eyes....", false); break; case 2: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look deep into my eyes....", false); break; case 3: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your eyes are getting very heavy....", false); break; case 4: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Sleepy....very sleepy....", false); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_From.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } } else { m_From.RevealingAction(); m_From.NextSkillTime = Core.TickCount; double minSkill = (double)m_Creature.Int / 3.0; if (minSkill < -10.0) { minSkill = -10.0; } if (minSkill > 90.0) { minSkill = 90.0; } minSkill += 8.3; LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(m_From).Hypnotism; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(m_From, lokaiSkill, minSkill, alreadyOwned ? minSkill : minSkill + 40); if (rating >= SuccessRating.PartialSuccess) { if (rating == SuccessRating.TooEasy) { m_From.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_From.SendMessage("You succeed in hypnotizing the creature."); } double duration = 15.0; switch (rating) { case SuccessRating.PartialSuccess: break; case SuccessRating.Success: duration += 5.0; break; case SuccessRating.CompleteSuccess: duration += 15.0; break; case SuccessRating.ExceptionalSuccess: duration += 25.0; break; case SuccessRating.TooEasy: duration += 45; break; } m_Creature.Freeze(TimeSpan.FromSeconds(duration)); m_Creature.Paralyze(TimeSpan.FromSeconds(duration)); m_Creature.Pacify(m_From, DateTime.Now.AddSeconds(duration)); } else { m_From.SendMessage("You fail to hypnotize the creature."); } } } else { DamageEntry de = m_Mobile.FindMostRecentDamageEntry(false); if (!m_From.InRange(m_Mobile, 6)) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away to continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are dead, and cannot continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CanSee(m_Mobile) || !m_From.InLOS(m_Mobile)) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have a clear path to the person you are hypnotizing, and must cease your attempt.", m_From.NetState); Stop(); } else if (!m_Mobile.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The person is dead, so you cannot continue hypnotizing them.", m_From.NetState); Stop(); } else if (m_Mobile is BaseEscortable && ((BaseEscortable)m_Mobile).Controlled && ((BaseEscortable)m_Mobile).ControlMaster == m_From) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "They will already obey you.", m_From.NetState); Stop(); } else if (m_Mobile.Frozen && m_Mobile.Paralyzed) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "They appear to be already in a trance.", m_From.NetState); Stop(); } else if (m_Count < m_FullCount) { m_From.RevealingAction(); switch (Utility.Random(5)) { case 0: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "You are getting sleepy....", false); break; case 1: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look into my eyes....", false); break; case 2: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look deep into my eyes....", false); break; case 3: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your eyes are getting very heavy....", false); break; case 4: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Sleepy....very sleepy....", false); break; } m_From.CheckTargetSkill(SkillName.EvalInt, m_Mobile, 0.0, 120.0); } else { m_From.RevealingAction(); m_From.NextSkillTime = Core.TickCount; m_From.CheckTargetSkill(SkillName.EvalInt, m_Mobile, 0.0, 120.0); double minSkill = (double)m_Mobile.Int / 3.0; if (minSkill < -10.0) { minSkill = -10.0; } if (minSkill > 90.0) { minSkill = 90.0; } minSkill += 10.0; LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(m_From).Hypnotism; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(m_From, lokaiSkill, minSkill, minSkill + 40); if (rating >= SuccessRating.PartialSuccess) { double duration = 15.0; switch (rating) { case SuccessRating.PartialSuccess: break; case SuccessRating.Success: duration += 5.0; break; case SuccessRating.CompleteSuccess: duration += 15.0; break; case SuccessRating.ExceptionalSuccess: duration += 25.0; break; case SuccessRating.TooEasy: duration += 45; break; } m_From.SendMessage("You successfully put your subject in a trance."); Mobile master = null; if (m_Mobile is BaseEscortable) { BaseEscortable target = (BaseEscortable)m_Mobile; if (((BaseEscortable)m_Mobile).Controlled) { master = target.ControlMaster; } target.Controlled = true; target.ControlMaster = m_From; m_From.SendMessage("The target will obey you for {0} seconds.", duration.ToString("F1")); new EscortableTimer(m_From, master, target, (int)duration).Start(); } else { m_Mobile.Freeze(TimeSpan.FromSeconds(duration)); m_Mobile.Paralyze(TimeSpan.FromSeconds(duration)); m_Mobile.SendMessage("You have been hypnotized!"); m_From.SendGump(new HypnotismGump(m_From, m_Mobile, duration, 1)); } } else { m_From.SendMessage("You fail to hypnotize your subject."); } } } }
private bool AddEntry(DamageEntry entry) { return(Entries.TryAdd(Entries.Count, entry)); }
public void AddDamageMarker(DamageEntry entry) { entry.Part = this; damageEntries.Add(entry); }
public override void OnDeath(Container c) { #region Taran: Reward all attackers List <DamageEntry> rights = DamageEntries; List <Mobile> toGiveGold = new List <Mobile>(); List <Mobile> toGiveItem = new List <Mobile>(); List <Mobile> toRemove = new List <Mobile>(); List <int> GoldToRecieve = new List <int>(); for (int i = 0; i < rights.Count; ++i) { DamageEntry de = rights[i]; //Only players get rewarded if (de.HasExpired || !de.Damager.Player) { DamageEntries.RemoveAt(i); continue; } toGiveGold.Add(de.Damager); GoldToRecieve.Add(de.DamageGiven * 5); //Player gets 5 times the damage dealt in gold if (de.DamageGiven > 700) //Players doing more than 700 damage gets a random weapon or armor { toGiveItem.Add(de.Damager); } } foreach (Mobile m in toGiveGold) { if (m is PlayerMobile) { int amountofgold = GoldToRecieve[toGiveGold.IndexOf(m)]; if (amountofgold > 100000) { amountofgold = 100000; //Taran: Could be good with a max of 100k if damage bugs occur } if (amountofgold > 65000) { m.AddToBackpack(new BankCheck(amountofgold)); } else { m.AddToBackpack(new Gold(amountofgold)); } m.SendAsciiMessage("You dealt {0} damage to the monster and got {1} gold", amountofgold / 5, amountofgold); } } foreach (Mobile m in toGiveItem) { if (m is PlayerMobile) { Item item = Loot.RandomArmorOrShieldOrWeapon(); if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6); armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); } m.AddToBackpack(item); m.SendAsciiMessage("You dealt more than 700 damage to the Fire Spirit, your reward is well deserved!"); } } #endregion List <Mobile> explosionDamage = new List <Mobile>(); foreach (Mobile m in Map.GetMobilesInRange(Location, 5)) { if (!(m is FireSpirit)) { explosionDamage.Add(m); } } for (int i = 0; i < explosionDamage.Count; i++) { Mobile m = explosionDamage[i]; m.Damage(5); m.FixedParticles(0x36BD, 20, 2, 5044, EffectLayer.Head); } base.OnDeath(c); }
private bool RemoveEntry(int key, DamageEntry entry) { return(Entries.TryRemove(key, out entry)); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049654, m_Tamer.NetState); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = Core.TickCount; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.RangeHome = -1; m_Creature.Home = new Point3D(0, 0, 0); m_Creature.IsBonded = false; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
public void DistribuirPontosDeExperiencia() { for (int contador = (this.DanosInfligidos.Count - 1); contador >= 0; --contador) { if (contador >= this.DanosInfligidos.Count) { continue; } DamageEntry danoInfligido = (DamageEntry)this.DanosInfligidos[contador]; if (danoInfligido.HasExpired) { continue; } Mobile atacante = danoInfligido.Damager; if (atacante == null || atacante.Deleted || !atacante.Player) { continue; } else if (atacante == null || atacante.Deleted) { continue; } if (atacante is BaseCreature) { BaseCreature criatura = (BaseCreature)atacante; if (criatura.Controlled && criatura.ControlMaster != null) { atacante = criatura.ControlMaster; } else if (criatura.Summoned && criatura.SummonMaster != null) { atacante = criatura.SummonMaster; } } else if (atacante is PlayerMobile) { if (this.AssassinadoPor is BaseGuard) { atacante.SendMessage("Os guardas fizeram o trabalho sujo! Você não recebe pontos de experiência."); } else if ((this.Domado && this.MestreDomador != null) || (this.MestreDomador == atacante) || (this.Invocado && this.MestreBruxo != null) || this.CriaturaRessureta) { if (this.Invocado && this.MestreBruxo != null) { atacante.SendMessage("Você matou um monstro invocado, e não recebe pontos de experiência."); } else if (this.MestreDomador == atacante || this.CriaturaRessureta) { atacante.SendMessage("Você matou um animal domado e não recebe pontos de experiência."); } } else { PlayerMobile jogadorAtacante = atacante as PlayerMobile; int pontosExperiencia = this.CalcularValorGanhoComExperiencia(jogadorAtacante.Fame); if (pontosExperiencia < 0) { pontosExperiencia = 0; } jogadorAtacante.SendMessage("Você recebeu {0} pontos de experiência", pontosExperiencia); ControladorODBC.ODBCConcederPontosXP(jogadorAtacante.Account.Username, jogadorAtacante.Name, pontosExperiencia); } } } }