public static BandageContext BeginHeal(Mobile healer, Mobile patient) { bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet); PlayerMobile playerPatient = patient as PlayerMobile; if (patient is Golem) { healer.SendLocalizedMessage(500970); // Bandages cannot be used on that. return(null); } else if (patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead) { healer.SendLocalizedMessage(500951); // You cannot heal that. return(null); } else if (!patient.Poisoned && patient.Hits == patient.HitsMax && !isDeadPet) { healer.SendLocalizedMessage(500955); // That being is not damaged! return(null); } else if (!patient.Alive && (patient.Map == null || !patient.Map.CanFit(patient.Location, 16, false, false))) { healer.SendLocalizedMessage(501042); // Target cannot be resurrected at that location. return(null); } if (healer.CanBeBeneficial(patient, true, true)) { healer.DoBeneficial(patient); bool onSelf = (healer == patient); int dex = healer.Dex; double seconds; double resDelay = 0; if (!patient.Alive) { resDelay += 5; } if (onSelf) { seconds = SkillCooldown.HealingSelfCooldown; DungeonArmor.PlayerDungeonArmorProfile bandagerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(healer, null); if (bandagerDungeonArmor.MatchingSet && !bandagerDungeonArmor.InPlayerCombat) { seconds -= bandagerDungeonArmor.DungeonArmorDetail.BandageSelfTimeReduction; } } else { seconds = SkillCooldown.HealingOtherCooldown + resDelay; } BandageContext context = GetContext(healer); if (context != null) { context.StopHeal(); } if (patient.Region is UOACZRegion) { seconds = 10; } double rapidTreatmentValue = healer.GetSpecialAbilityEntryValue(SpecialAbilityEffect.RapidTreatment); if (rapidTreatmentValue > 0) { seconds *= rapidTreatmentValue; } context = new BandageContext(healer, patient, TimeSpan.FromSeconds(seconds)); m_Table[healer] = context; if (!onSelf) { patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you. } healer.SendLocalizedMessage(500956); // You begin applying the bandages. return(context); } return(null); }
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; DungeonArmor.PlayerDungeonArmorProfile bandagerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(m_Healer, null); if (bandagerDungeonArmor.MatchingSet && !bandagerDungeonArmor.InPlayerCombat) { BandageHealThroughPoisonScalar += bandagerDungeonArmor.DungeonArmorDetail.BandageHealThroughPoisonScalar; effectHue = bandagerDungeonArmor.DungeonArmorDetail.EffectHue; } if (!m_Healer.Alive) { healDamage = false; healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } else if (Engines.ConPVP.DuelContext.CheckSuddenDeath(m_Patient)) { healDamage = false; m_Healer.SendMessage(0x22, "You cannot use this item when in sudden death."); return; } 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.IsDeadPet)) { 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 { 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.IsDeadPet) { Mobile master = petPatient.ControlMaster; /* * if (!petPatient.CanBeResurrectedThroughVeterinary) * { * m_Healer.SendMessage("Another item is required to resurrect this creature"); * healerNumber = 500966; // You are unable to resurrect your patient. * } * */ if (master != null && master.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. 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.IsDeadPet) { 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 { 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; if (healThroughPoison) { toHeal *= BandageHealThroughPoisonScalar; } PlayerMobile playerHealer = m_Healer as PlayerMobile; if (playerHealer != null) { if (UOACZSystem.IsUOACZValidMobile(playerHealer)) { if (playerHealer.IsUOACZHuman) { toHeal += 20; } } 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); } }