public static void UpdateArmorProperties(Mobile from) { if (!(from is PlayerMobile)) { return; } PlayerMobile player = from as PlayerMobile; if (player.m_AspectArmorProfile == null) { player.m_AspectArmorProfile = new AspectArmorProfile(); } bool validAspectArmorSet = false; AspectArmorProfile aspectArmorProfile = GetAspectArmorProfile(from); if (aspectArmorProfile != null) { validAspectArmorSet = true; } List <Layer> m_Layers = new List <Layer>(); m_Layers.Add(Layer.Helm); m_Layers.Add(Layer.Neck); m_Layers.Add(Layer.InnerTorso); m_Layers.Add(Layer.Arms); m_Layers.Add(Layer.Gloves); m_Layers.Add(Layer.Pants); for (int a = 0; a < m_Layers.Count; a++) { BaseArmor armor = from.FindItemOnLayer(m_Layers[a]) as BaseArmor; if (armor != null) { armor.BaseArmorRating = armor.ArmorBase; if (validAspectArmorSet) { armor.BaseArmorRating = armor.ArmorBase * (1 + AspectGear.BaseArmorRatingBonus + (AspectGear.ArmorRatingBonusPerTier * (double)armor.TierLevel)); } else if (armor.Aspect != AspectEnum.None && armor.TierLevel > 0) { armor.BaseArmorRating = armor.ArmorBase * (1 + AspectGear.BaseArmorRatingBonus); } } } }
public void DoCure(Mobile from) { bool cure = false; CureLevelInfo[] info = LevelInfo; for (int i = 0; i < info.Length; ++i) { CureLevelInfo li = info[i]; if (li.Poison == from.Poison && Scale(from, li.Chance) > Utility.RandomDouble()) { cure = true; break; } } if (!cure) { AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from); //Poison Aspect if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Poison) { double extraCureChance = AspectGear.PoisonCureChanceBonus * (AspectGear.PoisonCureChanceBonusPerTier * (double)aspectArmorProfile.m_TierLevel); if (Utility.RandomDouble() <= extraCureChance) { cure = true; //TEST: Add Aspect Visuals } } } } if (cure && from.CurePoison(from)) { from.SendLocalizedMessage(500231); // You feel cured of poison! from.FixedEffect(0x373A, 10, 15); from.PlaySound(0x1E0); } else if (!cure) { from.SendLocalizedMessage(500232); // That potion was not strong enough to cure your ailment! } }
public static bool PlayDrinkEffect(Mobile mobile) { mobile.RevealingAction(); mobile.PlaySound(0x2D6); bool freeConsume = false; bool dropBottle = true; PlayerMobile player = mobile as PlayerMobile; if (ArenaFight.AllowFreeConsume(player, typeof(BasePotion))) { freeConsume = true; dropBottle = false; } //Water Aspect AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(mobile); if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Water) { double waterAspectChance = AspectGear.WaterChanceForPotionNoConsume * (AspectGear.WaterChanceForPotionNoConsumePerTier * (double)aspectArmorProfile.m_TierLevel); if (Utility.RandomDouble() <= waterAspectChance) { freeConsume = true; dropBottle = false; //TEST: Add Aspect Visual } } } if (dropBottle) { mobile.AddToBackpack(new Bottle()); } if (mobile.Body.IsHuman /*&& !m.Mounted*/) { mobile.Animate(34, 5, 1, true, false, 0); } return(freeConsume); }
public void EndHeal() { StopHeal(); int healerNumber = -1, patientNumber = -1; bool playSound = true; bool checkSkills = false; SkillName primarySkill = GetPrimarySkill(m_Patient); SkillName secondarySkill = GetSecondarySkill(m_Patient); BaseCreature petPatient = m_Patient as BaseCreature; bool healDamage = true; bool healThroughPoison = true; double BandageHealThroughPoisonScalar = SpellHelper.HealThroughPoisonScalar; int effectHue = 0; AspectArmorProfile patientAspectArmorProfile = AspectGear.GetAspectArmorProfile(m_Patient); if (!m_Healer.Alive) { healDamage = false; healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } else if (m_Patient.Hidden && m_Patient != m_Healer) { healDamage = false; m_Healer.SendMessage("You can no longer see your patient."); return; } else if (!m_Healer.InRange(m_Patient, Bandage.Range)) { healDamage = false; healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if ((SpellHelper.CheckMulti(m_Healer.Location, m_Healer.Map) || SpellHelper.CheckMulti(m_Patient.Location, m_Patient.Map)) && !m_Healer.InLOS(m_Patient)) { healDamage = false; healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadFollower)) { healDamage = false; double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing - 68.0) / 50.0) - (m_Slips * 0.02); if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) || (Core.SE && petPatient.ControlMaster == m_Healer)) //TODO: Dbl check doesn't check for faction of the horse here? { if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false)) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } else if (ArenaController.GetArenaAtLocation(m_Patient.Location, m_Patient.Map) != null) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } else { healerNumber = 500965; // You are able to resurrect your patient. patientNumber = -1; m_Patient.PlaySound(0x214); m_Patient.FixedEffect(0x376A, 10, 16); if (petPatient != null && petPatient.IsDeadFollower) { Mobile master = petPatient.ControlMaster; if (master != null && master.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. //TEST: NEW RESSURECT GUMP //master.CloseGump(typeof(PetResurrectGump)); //master.SendGump(new PetResurrectGump(m_Healer, petPatient)); } else { bool found = false; if (!found) { healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection. } } } else { m_Patient.CloseGump(typeof(ResurrectGump)); m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer)); } } } else { if (petPatient != null && petPatient.IsDeadFollower) { healerNumber = 503256; // You fail to resurrect the creature. } else { healerNumber = 500966; // You are unable to resurrect your patient. } patientNumber = -1; } } else if (m_Patient.Poisoned) { healDamage = false; m_Healer.SendLocalizedMessage(500969); // You finish applying the bandages. double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.05) - (m_Slips * 0.02); if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble()) { if (m_Patient.CurePoison(m_Healer)) { healerNumber = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons. patientNumber = 1010059; // You have been cured of all poisons. } else { healerNumber = -1; patientNumber = -1; } } else { bool cured = false; AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(m_Patient); //Poison Aspect if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Poison) { double extraCureChance = AspectGear.PoisonCureChanceBonus * (AspectGear.PoisonCureChanceBonusPerTier * (double)aspectArmorProfile.m_TierLevel); if (Utility.RandomDouble() <= extraCureChance) { m_Patient.CurePoison(m_Healer); cured = true; //TEST: Add Aspect Visuals } } } if (!cured) { healerNumber = 1010060; // You have failed to cure your target! patientNumber = -1; } } } else if (m_Patient.Hits == m_Patient.HitsMax) { healDamage = false; healerNumber = 500967; // You heal what little damage your patient had. patientNumber = -1; } if (healDamage) { checkSkills = true; patientNumber = -1; double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing + 20.0) / 100.0) - (m_Slips * 0.02); if (chance >= Utility.RandomDouble()) { healerNumber = 500969; // You finish applying the bandages. double min, max; if (Core.AOS) { min = (anatomy / 8.0) + (healing / 5.0) + 4.0; max = (anatomy / 6.0) + (healing / 2.5) + 4.0; } else { min = (anatomy / 5.0) + (healing / 5.0) + 3.0; max = (anatomy / 5.0) + (healing / 2.0) + 10.0; } double toHeal = min + (Utility.RandomDouble() * (max - min)); if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal) { toHeal += m_Patient.HitsMax / 100; } toHeal -= m_Slips * 2.5; PlayerMobile playerHealer = m_Healer as PlayerMobile; if (playerHealer != null) { double superiorHealing = playerHealer.GetSpecialAbilityEntryValue(SpecialAbilityEffect.SuperiorHealing); if (superiorHealing > 0) { toHeal *= superiorHealing; } } if (toHeal < 1) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } int finalHeal = (int)toHeal; m_Patient.Heal(finalHeal, m_Healer, false); } else { healerNumber = 500968; // You apply the bandages, but they barely help. playSound = false; } } if (healerNumber != -1) { m_Healer.SendLocalizedMessage(healerNumber); } if (patientNumber != -1) { m_Patient.SendLocalizedMessage(patientNumber); } if (healThroughPoison) { Effects.PlaySound(m_Healer.Location, m_Healer.Map, 0x64B); Effects.SendLocationParticles(EffectItem.Create(m_Healer.Location, m_Healer.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, effectHue, 0, 5005, 0); } if (playSound) { m_Patient.PlaySound(0x57); } if (checkSkills) { m_Healer.CheckSkill(secondarySkill, 0.0, 120.0, 1.0); m_Healer.CheckSkill(primarySkill, 0.0, 120.0, 1.0); } }