protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted, m_Bandage is EnhancedBandage) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { Mobile target = targeted as Mobile; if (target.Hidden) { from.SendMessage("That cannot be seen."); return; } else if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { PlayerMobile playerTarget = targeted as PlayerMobile; if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { if (!Engines.ConPVP.DuelContext.IsFreeConsume(from)) { m_Bandage.Consume(); } } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendAsciiMessage("You are too far away to do that."); //from.SendLocalizedMessage( 500295 ); // } } else { from.SendAsciiMessage("Bandages can not be used on that."); //from.SendLocalizedMessage( 500970 ); // } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { Mobile m = targeted as Mobile; if (Bandage.ProximityCheck(from, m, Core.AOS ? 2 : 1) == false) { from.SendLocalizedMessage(501043); // Target is not close enough. } else if (from.InRange(m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); if (from != null && from.Backpack != null) { Bandage b = null; foreach (Item item in from.Backpack.Items) { if (item is Bandage) { b = item as Bandage; break; } } if (b != null) { from.Emote("*impregne un bandage du baume*"); from.Backpack.AddItem(new BandageBaume()); b.Consume(); Delete(); } from.SendMessage("Vous devez avoir un bandage propre pour l'utiliser"); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Range)) { BandageContext context; if ((context = BandageContext.BeginHeal(from, (Mobile)targeted, m_Bandage)) != null) { m_Bandage.OnHealStarted(context); m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is PlayerMobile && ((PlayerMobile)targeted).Undead) { if (from == targeted) { from.SendMessage("You have no need for the healing techniques of mortals."); } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { Mobile targetedMobile = (Mobile)targeted; if (from.InRange(m_Bandage.GetWorldLocation(), 3) && from.InRange(targetedMobile.Location, Bandage.Range)) { if (from is PlayerMobile) { ((PlayerMobile)from).SpellCheck(); } from.PlaySound(0x57); //ClearHandsBandage(from); BandageContext.BeginHeal(from, targetedMobile, m_Bandage); } else { from.SendAsciiMessage("You are too far away to do that."); } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendAsciiMessage("Bandages can not be used on that."); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { from.PublicOverheadMessage(MessageType.Regular, 0x22, true, "** Begins healing with bandages! **"); from.Freeze(TimeSpan.FromSeconds(1.5)); if (!Engines.ConPVP.DuelContext.IsFreeConsume(from)) { m_Bandage.Consume(); } } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (!HasFreeHand(from)) { from.SendMessage("Vous devez avoir les mains libres pour pouvoir soigner."); } else if (from.Mounted) { from.SendMessage("Vous ne pouvez soigner sur une monture."); } else if (targeted is PlayerMobile && ((PlayerMobile)targeted).MortEngine.RisqueDeMort) { from.SendMessage("Cette personne est trop affaiblie pour être soignée."); } else if (HasChestArmor((Mobile)targeted)) { from.SendMessage("Vous ne pouvez soigner si la personne porte un plastron."); } else if (from.InRange(m_Bandage.GetWorldLocation(), 1)) { BandageContext context = BandageContext.GetContext((Mobile)targeted); if (context != null) { from.SendMessage("Vous devez attendre avant de soigner à nouveau cette personne."); } else if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { bool consume = true; if (from.Player) { Medic med = Perk.GetByType <Medic>((Player)from); if (med != null) { consume = !med.TryRecoverBandage(); from.SendMessage("You manage to salvage some of the bandage."); } } if (consume) { m_Bandage.Consume(); } } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
public static bool tryToHeal(Mobile healer, Mobile patient, Bandage bandage) { if (patient.Alive && (patient.Hits < patient.HitsMax || patient.Poisoned)) { if (healer == patient) { patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you. } healer.SendLocalizedMessage(500956); // You begin applying the bandages. double finalDelay = new Random().NextDouble() * (Bandage.delayMax - Bandage.delayMin) + Bandage.delayMin; contextTable[healer] = new HealingContext(healer, patient, finalDelay); bandage.Consume(); return(true); } return(false); }
protected override void OnTick() { base.OnTick(); if (mSoigneur == null) { return; } if (!mSoigneur.Alive) { return; } if (mVictime == null) { return; } if (!mVictime.Alive) { return; } if (mBandage == null) { return; } if (mSoigneur.Competences[CompType.PremiersSecours].roll(15)) { mSoigneur.Emote("*Arrête l'hémoragie"); mVictime.StopSaignements(); } else { mSoigneur.Emote("*N'arrive pas à arrêter l'hémoragie*"); } if (mSoigneur.Backpack != null) { mSoigneur.Backpack.AddItem(new BandageSale()); } if (mBandage != null) { mBandage.Consume(); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } //para tratar de um corpo caido if (targeted is Corpse) { Corpse corpo = (Corpse)targeted; if (corpo.Owner != null && corpo.Owner is Jogador) { targeted = corpo.Owner; } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
public BandageContext( Mobile healer, Mobile patient, TimeSpan delay, Bandage origin ) { m_Healer = healer; m_Patient = patient; if( m_Patient != null && !m_Patient.Alive ) { if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 || m_Healer.Skills[SkillName.Healing].Base < 100.0 ) { if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 && m_Healer.Skills[SkillName.Healing].Base < 100.0 ) { m_Healer.SendAsciiMessage( "You need GM healing and anatomy to resurrect your target." ); return; } else if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 ) { m_Healer.SendAsciiMessage( "You need GM anatomy to resurrect your target." ); return; } else if( m_Healer.Skills[SkillName.Healing].Base < 100.0 ) { m_Healer.SendAsciiMessage( "You need GM healing to resurrect your target." ); return; } } if( m_Healer.Hits <= 50 ) { m_Healer.SendAsciiMessage( "You need to have more than 50 hp to resurrect your target" ); return; } if( m_Patient.Region is HouseRegion ) { m_Healer.SendAsciiMessage( "You can't resurrect people in house regions." ); //Server.Multis.BaseHouse patientHouse = (m_Patient.Region as HouseRegion).House; ////The owner can resurrect who ever he wants. //if (patientHouse.IsOwner(m_Healer) || patientHouse.IsCoOwner(m_Healer)) //{ // m_Patient.Resurrect(); // m_Patient.Hits = 10; // m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*"); // m_Healer.Hits -= 50; //} ////The patient can be ressed by anoyone as long as he is an owner, co owner or friend //else if (patientHouse.IsOwner(m_Patient) || patientHouse.IsCoOwner(m_Patient) || patientHouse.IsFriend(m_Patient)) //{ // m_Patient.Resurrect(); // m_Patient.Hits = 10; // m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*"); // m_Healer.Hits -= 50; //} //else //{ // m_Patient.SendAsciiMessage("You cannot be resurrected in this region!"); // m_Healer.SendAsciiMessage("You cannot resurrect in this region!"); //} } else { m_Patient.PlaySound( 0x214 ); m_Patient.Resurrect(); m_Patient.Hits = 10; m_Healer.PublicOverheadMessage( MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*" ); m_Healer.Hits -= 50; origin.Consume(1); } } else { m_Timer = new InternalTimer( this, delay, origin ); m_Timer.Start(); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Corpse) { Corpse c = targeted as Corpse; bool found = false; Mobile owner = c.Owner; Timer m_Revive; Mobile ghost = null; if (owner == null || owner.Deleted || (owner is TeiravonMobile && ((TeiravonMobile)owner).IsUndead()) || c.ItemID != 0x2006) { from.SendMessage("You cannot revive that!"); return; } IPooledEnumerable eable = c.Map.GetMobilesInRange(c.Location, 1); foreach (Mobile m in eable) { if (m == c.Owner) { found = true; ghost = m; } } eable.Free(); if (!found && c.Owner != null) { from.SendMessage("The body is cold and unresponsive as if the spirit has left it."); c.Owner.SendMessage("You feel drawn to your body."); return; } if (found && ghost != null && !ghost.Alive) { from.SendMessage("You attempt to revive the fallen."); m_Revive = new ReviveTimer(from, c, ghost); SpellHelper.Turn(from, c); BandageClearHands(from); from.Animate(32, 5, 1, true, false, 0); m_Bandage.Consume(); m_Revive.Start(); return; } } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1)) { TeiravonMobile m_Player = targeted as TeiravonMobile; Mobile m = targeted as Mobile; if (targeted is TeiravonMobile && m_Player.PlayerRace == TeiravonMobile.Race.Undead) { from.SendMessage("The dead cannot be bandaged."); return; } if (m_Slayer.Slays(m)) { from.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead! return; } if (m_Player != null && m_Player.NextHeal - DateTime.Now > new TimeSpan(0, 0, 3)) { m_Player.SendMessage("It's too soon to do this again."); return; } if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); //from.ClearHands(); BandageClearHands(from); if (m_Player != null) { m_Player.NextHeal = DateTime.Now + TimeSpan.FromSeconds(2.0); } } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } var entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, m_Bandage)) { return; } if (targeted is BaseCreature && (((BaseCreature)targeted).Pseu_CanBeHealed == false || ((BaseCreature)targeted).ChampSpawn != null)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951); // You cannot heal that. } else if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), GetRange(from.Expansion))) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { var region1 = from.Region as CustomRegion; if (!DuelContext.IsFreeConsume(from) && (region1 == null || !region1.PlayingGame(from))) { IUOFBattle battle = null; if (from is PlayerMobile) { battle = AutoPvP.FindBattleI <IUOFBattle>((PlayerMobile)from); } if (battle == null || !battle.NoConsume) { m_Bandage.Consume(); } } } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); Server.Gumps.QuickBar.RefreshQuickBar(from); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is HenchmanFighterItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80) { HenchmanFighterItem friend = (HenchmanFighterItem)targeted; if (friend.HenchDead > 0) { friend.Name = "fighter henchman"; friend.HenchDead = 0; friend.InvalidateProperties(); m_Bandage.Consume(); } else { from.SendMessage("They are not dead."); } } else if (targeted is HenchmanWizardItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80) { HenchmanWizardItem friend = (HenchmanWizardItem)targeted; if (friend.HenchDead > 0) { friend.Name = "wizard henchman"; friend.HenchDead = 0; friend.InvalidateProperties(); m_Bandage.Consume(); } else { from.SendMessage("They are not dead."); } } else if (targeted is HenchmanArcherItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80) { HenchmanArcherItem friend = (HenchmanArcherItem)targeted; if (friend.HenchDead > 0) { friend.Name = "archer henchman"; friend.HenchDead = 0; friend.InvalidateProperties(); m_Bandage.Consume(); } else { from.SendMessage("They are not dead."); } } else if (targeted is HenchmanMonsterItem && from.Skills[SkillName.Anatomy].Value >= 80 && from.Skills[SkillName.Healing].Value >= 80) { HenchmanMonsterItem friend = (HenchmanMonsterItem)targeted; if (friend.HenchDead > 0) { friend.Name = "creature henchman"; friend.HenchDead = 0; friend.InvalidateProperties(); m_Bandage.Consume(); } else { from.SendMessage("They are not dead."); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
public static bool tryToHeal(Mobile healer, Mobile patient, Bandage bandage){ if(patient.Alive && (patient.Hits < patient.HitsMax || patient.Poisoned) ){ if ( healer == patient) patient.SendLocalizedMessage( 1008078, false, healer.Name ); // : Attempting to heal you. healer.SendLocalizedMessage( 500956 ); // You begin applying the bandages. double finalDelay = new Random().NextDouble()*(Bandage.delayMax-Bandage.delayMin)+Bandage.delayMin; contextTable[healer] = new HealingContext(healer, patient, finalDelay); bandage.Consume(); return true; } return false; }
public BandageContext(Mobile healer, Mobile patient, TimeSpan delay, Bandage origin) { m_Healer = healer; m_Patient = patient; if (m_Patient != null && !m_Patient.Alive) { if (m_Healer.Skills[SkillName.Anatomy].Base < 100.0 || m_Healer.Skills[SkillName.Healing].Base < 100.0) { if (m_Healer.Skills[SkillName.Anatomy].Base < 100.0 && m_Healer.Skills[SkillName.Healing].Base < 100.0) { m_Healer.SendAsciiMessage("You need GM healing and anatomy to resurrect your target."); return; } else if (m_Healer.Skills[SkillName.Anatomy].Base < 100.0) { m_Healer.SendAsciiMessage("You need GM anatomy to resurrect your target."); return; } else if (m_Healer.Skills[SkillName.Healing].Base < 100.0) { m_Healer.SendAsciiMessage("You need GM healing to resurrect your target."); return; } } if (m_Healer.Hits <= 50) { m_Healer.SendAsciiMessage("You need to have more than 50 hp to resurrect your target"); return; } if (m_Patient.Region is HouseRegion) { m_Healer.SendAsciiMessage("You can't resurrect people in house regions."); //Server.Multis.BaseHouse patientHouse = (m_Patient.Region as HouseRegion).House; ////The owner can resurrect who ever he wants. //if (patientHouse.IsOwner(m_Healer) || patientHouse.IsCoOwner(m_Healer)) //{ // m_Patient.Resurrect(); // m_Patient.Hits = 10; // m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*"); // m_Healer.Hits -= 50; //} ////The patient can be ressed by anoyone as long as he is an owner, co owner or friend //else if (patientHouse.IsOwner(m_Patient) || patientHouse.IsCoOwner(m_Patient) || patientHouse.IsFriend(m_Patient)) //{ // m_Patient.Resurrect(); // m_Patient.Hits = 10; // m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*"); // m_Healer.Hits -= 50; //} //else //{ // m_Patient.SendAsciiMessage("You cannot be resurrected in this region!"); // m_Healer.SendAsciiMessage("You cannot resurrect in this region!"); //} } else { m_Patient.PlaySound(0x214); m_Patient.Resurrect(); m_Patient.Hits = 10; m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*"); m_Healer.Hits -= 50; origin.Consume(1); } } else { m_Timer = new InternalTimer(this, delay, origin); m_Timer.Start(); } }
public void EndHeal( Bandage origin ) { StopHeal(); if( m_Healer is PlayerMobile ) ((PlayerMobile)m_Healer).WeaponTimerCheck(); int healerNumber = -1; int patientNumber = -1; bool checkSkills = false; SkillName primarySkill = GetPrimarySkill( m_Patient ); SkillName secondarySkill = GetSecondarySkill( m_Patient ); BaseCreature petPatient = m_Patient as BaseCreature; if( !m_Healer.Alive ) healerNumber = 500962; // You were unable to finish your work before you died. else if (m_Healer.Paralyzed) { m_Healer.SendAsciiMessage("You were unable to finish your work before you got paralyzed"); return; } else if( !m_Healer.InRange( m_Patient, Bandage.Range ) ) healerNumber = 500963; // You did not stay close enough to heal your target. else if( !m_Patient.Alive || ( petPatient != null && petPatient.IsDeadPet ) ) { 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 is FactionWarHorse && 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. else if( m_Patient.Region != null && m_Patient.Region.IsPartOf( "Khaldun" ) ) { healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life. } else { healerNumber = 500965; // You are able to resurrect your patient. m_Patient.FixedEffect( 0x376A, 10, 16 ); if( petPatient != null && petPatient.IsDeadPet ) { Mobile master = petPatient.ControlMaster; if (master != null && m_Healer == master) { petPatient.ResurrectPet(); for (int i = 0; i < petPatient.Skills.Length; ++i) { petPatient.Skills[i].Base -= 0.1; } } else 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; List<Mobile> friends = petPatient.Friends; for( int i = 0; friends != null && i < friends.Count; ++i ) { Mobile friend = friends[i]; if( friend.InRange( petPatient, 3 ) ) { healerNumber = 503255; // You are able to resurrect the creature. friend.CloseGump( typeof( PetResurrectGump ) ); friend.SendGump( new PetResurrectGump( m_Healer, petPatient ) ); found = true; break; } } 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. } } else if (m_Patient.Poisoned) { 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 - 40.0) / 50.0) - (m_Patient.Poison.Level * 0.11) - (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( BleedAttack.IsBleeding( m_Patient ) ) BleedAttack.EndBleed( m_Patient, false ); else if( MortalStrike.IsWounded( m_Patient ) ) healerNumber = ( m_Healer == m_Patient ? 1005000 : 1010398 ); else if( m_Patient.Hits == m_Patient.HitsMax ) healerNumber = 500967; // You heal what little damage your patient had. else { checkSkills = true; patientNumber = -1; Bandage bandage = null; if( origin.Parent == null && !origin.Deleted ) origin.Consume( 1 ); else if( ( bandage = m_Healer.Backpack.FindItemByType( typeof( Bandage ), true ) as Bandage ) == null ) { m_Healer.SendAsciiMessage( "You don't have any bandages." ); return; } else bandage.Consume( 1 ); double healing = m_Healer.Skills[primarySkill].Base; double anatomy = m_Healer.Skills[secondarySkill].Base; //Loki edit: Dexterity improves healing chance double chance = (healing/100.0) * (0.91 + (((double)m_Healer.RawDex - 80.0) / 1000.0)); if( chance > Utility.RandomDouble() ) { double min, max; min = 0.04 * ( ( anatomy / 4.0 ) + ( healing / 4.0 ) ); max = ( ( anatomy / 4.0 ) + ( healing / 4.0 ) ) - 4; //Loki edit: Bonus from dexterity double dexbonus = ((double)m_Healer.RawDex - 80.0) / 10.0; min += dexbonus; max += dexbonus / 2; if( max < 2 ) max = 2; double toHeal = Utility.RandomMinMax( (int)min, (int)max ); if( toHeal < 1 ) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } else if( ( !origin.Deleted && (!origin.EventItem || (origin.EventItem && origin.EventItemConsume)) ) || ( bandage != null && (!bandage.EventItem || (bandage.EventItem && bandage.EventItemConsume)) ) ) { Item item = new BloodyBandage(); if (origin.EventItem || (bandage != null && bandage.EventItem)) { item.EventItem = true; item.Hue = origin.Hue; item.Name = "event Bloody bandage"; } Mobile from = m_Healer; if (from.AddToBackpack(item)) { from.SendAsciiMessage("You put the {0} in your pack.", item.Name ?? CliLoc.LocToString(item.LabelNumber)); } else //Taran: Bloody bandages stack on ground if the player is overweight { from.SendAsciiMessage("You are overweight and put the {0} on the ground.", item.Name ?? CliLoc.LocToString(item.LabelNumber)); IPooledEnumerable eable = from.Map.GetItemsInRange(from.Location, 0); foreach (Item i in eable) { if (i is BloodyBandage) { if (i.Serial != item.Serial) { i.Amount++; item.Delete(); } break; } } eable.Free(); } } else if ( !origin.Deleted && (origin.EventItem && !origin.EventItemConsume)) { Mobile from = m_Healer; from.PlaySound(0x57); from.SendAsciiMessage("You are able to re-use your bandage and put it in your pack."); } //m_Patient.Heal( (int)toHeal ); //Rev ~ 140 update m_Patient.Heal((int)toHeal, m_Healer, false); } else healerNumber = 500968; // You apply the bandages, but they barely help. m_Healer.CheckSkill( secondarySkill, 0.0, 120.0 ); m_Healer.CheckSkill( primarySkill, 0.0, 120.0 ); } if( healerNumber != -1 ) m_Healer.SendAsciiMessage( CliLoc.LocToString( healerNumber ) ); if (patientNumber != -1) m_Patient.SendLocalizedMessage(patientNumber); if (checkSkills) { m_Healer.CheckSkill(secondarySkill, 0.0, 100.0); m_Healer.CheckSkill(primarySkill, 0.0, 100.0); } }
public void EndHeal(Bandage origin) { StopHeal(); if (m_Healer is PlayerMobile) { ((PlayerMobile)m_Healer).WeaponTimerCheck(); } int healerNumber = -1; int patientNumber = -1; bool checkSkills = false; SkillName primarySkill = GetPrimarySkill(m_Patient); SkillName secondarySkill = GetSecondarySkill(m_Patient); BaseCreature petPatient = m_Patient as BaseCreature; if (!m_Healer.Alive) { healerNumber = 500962; // You were unable to finish your work before you died. } else if (m_Healer.Paralyzed) { m_Healer.SendAsciiMessage("You were unable to finish your work before you got paralyzed"); return; } else if (!m_Healer.InRange(m_Patient, Bandage.Range)) { healerNumber = 500963; // You did not stay close enough to heal your target. } else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet)) { 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 is FactionWarHorse && 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. } else if (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun")) { healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life. } else { healerNumber = 500965; // You are able to resurrect your patient. m_Patient.FixedEffect(0x376A, 10, 16); if (petPatient != null && petPatient.IsDeadPet) { Mobile master = petPatient.ControlMaster; if (master != null && m_Healer == master) { petPatient.ResurrectPet(); for (int i = 0; i < petPatient.Skills.Length; ++i) { petPatient.Skills[i].Base -= 0.1; } } else 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; List <Mobile> friends = petPatient.Friends; for (int i = 0; friends != null && i < friends.Count; ++i) { Mobile friend = friends[i]; if (friend.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. friend.CloseGump(typeof(PetResurrectGump)); friend.SendGump(new PetResurrectGump(m_Healer, petPatient)); found = true; break; } } 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. } } } else if (m_Patient.Poisoned) { 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 - 40.0) / 50.0) - (m_Patient.Poison.Level * 0.11) - (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 (BleedAttack.IsBleeding(m_Patient)) { BleedAttack.EndBleed(m_Patient, false); } else if (MortalStrike.IsWounded(m_Patient)) { healerNumber = (m_Healer == m_Patient ? 1005000 : 1010398); } else if (m_Patient.Hits == m_Patient.HitsMax) { healerNumber = 500967; // You heal what little damage your patient had. } else { checkSkills = true; patientNumber = -1; Bandage bandage = null; if (origin.Parent == null && !origin.Deleted) { origin.Consume(1); } else if ((bandage = m_Healer.Backpack.FindItemByType(typeof(Bandage), true) as Bandage) == null) { m_Healer.SendAsciiMessage("You don't have any bandages."); return; } else { bandage.Consume(1); } double healing = m_Healer.Skills[primarySkill].Base; double anatomy = m_Healer.Skills[secondarySkill].Base; //Loki edit: Dexterity improves healing chance double chance = (healing / 100.0) * (0.91 + (((double)m_Healer.RawDex - 80.0) / 1000.0)); if (chance > Utility.RandomDouble()) { double min, max; min = 0.04 * ((anatomy / 4.0) + (healing / 4.0)); max = ((anatomy / 4.0) + (healing / 4.0)) - 4; //Loki edit: Bonus from dexterity double dexbonus = ((double)m_Healer.RawDex - 80.0) / 10.0; min += dexbonus; max += dexbonus / 2; if (max < 2) { max = 2; } double toHeal = Utility.RandomMinMax((int)min, (int)max); if (toHeal < 1) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } else if ((!origin.Deleted && (!origin.EventItem || (origin.EventItem && origin.EventItemConsume))) || (bandage != null && (!bandage.EventItem || (bandage.EventItem && bandage.EventItemConsume)))) { Item item = new BloodyBandage(); if (origin.EventItem || (bandage != null && bandage.EventItem)) { item.EventItem = true; item.Hue = origin.Hue; item.Name = "event Bloody bandage"; } Mobile from = m_Healer; if (from.AddToBackpack(item)) { from.SendAsciiMessage("You put the {0} in your pack.", item.Name ?? CliLoc.LocToString(item.LabelNumber)); } else //Taran: Bloody bandages stack on ground if the player is overweight { from.SendAsciiMessage("You are overweight and put the {0} on the ground.", item.Name ?? CliLoc.LocToString(item.LabelNumber)); IPooledEnumerable eable = from.Map.GetItemsInRange(from.Location, 0); foreach (Item i in eable) { if (i is BloodyBandage) { if (i.Serial != item.Serial) { i.Amount++; item.Delete(); } break; } } eable.Free(); } } else if (!origin.Deleted && (origin.EventItem && !origin.EventItemConsume)) { Mobile from = m_Healer; from.PlaySound(0x57); from.SendAsciiMessage("You are able to re-use your bandage and put it in your pack."); } //m_Patient.Heal( (int)toHeal ); //Rev ~ 140 update m_Patient.Heal((int)toHeal, m_Healer, false); } else { healerNumber = 500968; // You apply the bandages, but they barely help. } m_Healer.CheckSkill(secondarySkill, 0.0, 120.0); m_Healer.CheckSkill(primarySkill, 0.0, 120.0); } if (healerNumber != -1) { m_Healer.SendAsciiMessage(CliLoc.LocToString(healerNumber)); } if (patientNumber != -1) { m_Patient.SendLocalizedMessage(patientNumber); } if (checkSkills) { m_Healer.CheckSkill(secondarySkill, 0.0, 100.0); m_Healer.CheckSkill(primarySkill, 0.0, 100.0); } }