Пример #1
0
        public static void tryObtainBloodyBandage(Mobile healer)
        {
            if (chanceToRecover == -1)
            {
                return;
            }

            if (UtilityUOT.checkChance(chanceToRecover))
            {
                healer.AddToBackpack(new BloodyBandage(1));
//				m.SendMessage( "You were able to recover a soiled bandage." ); //Innecesario.
            }
        }
Пример #2
0
            private void healNow()
            {
                int  healerMessage            = -1;
                int  patientMessage           = -1;
                int  poisonMessage            = -1;
                bool playSound                = false;
                bool tryToObtainBloodyBandage = false;

                //El healer está muerto.
                if (!healer.Alive)
                {
                    healerMessage  = 500962;                    // You were unable to finish your work before you died.
                    patientMessage = -1;
                    playSound      = false;

                    //El healer está muy lejos del patient.
                }
                else if (!healer.InRange(patient, Bandage.range))
                {
                    healerMessage  = 500963;                    // You did not stay close enough to heal your target.
                    patientMessage = -1;
                    playSound      = false;

                    tryToObtainBloodyBandage = true;

                    //El patient está vivo.
                }
                else if (patient.Alive)
                {
                    //Le falta vida.
                    if (patient.Hits < patient.HitsMax)
                    {
                        double antm = healer.Skills.Anatomy.Value;
                        double heal = healer.Skills.Healing.Value;

                        double chance;
                        if (healer.Hunger < 7 /* TODO Food factor!! */)
                        {
                            chance = ((antm + heal) / 200) * (healer.Hunger / 7);                             //TODO food factor!!
                        }
                        else
                        {
                            chance = (antm + heal) / 200;
                        }

                        //TODO pAcierto=100-{(100-pAcierto) 0}

                        if (UtilityUOT.checkChance(chance))
                        {
                            double hmax;
                            double hmin;
                            if (healer.Warmode)                              //TODO Ambas manos libres, no sólo en modo warmode.
                            {
                                hmax = Bandage.maxHealingBussy * (antm + heal) / 200;
                                hmin = hmax * Bandage.minHealingFactorBussy;
                            }
                            else
                            {
                                hmax = Bandage.maxHealingFree * (antm + heal) / 200;
                                hmin = hmax * Bandage.minHealingFactorFree;
                            }
                            double h = new Random().NextDouble() * (hmax - hmin) + hmin;
                            double toHeal;
                            if (h > (patient.HitsMax - patient.Hits))
                            {
                                toHeal = patient.HitsMax - patient.Hits;
                            }
                            else
                            {
                                toHeal = h;
                            }
                            patient.Heal((int)Math.Round(toHeal), healer, true);

                            healerMessage  = 500969;                            // You finish applying the bandages.
                            patientMessage = -1;
                            playSound      = true;
                        }
                        else
                        {
                            healerMessage = 500968;                             // You apply the bandages, but they barely help.
                        }

                        tryToObtainBloodyBandage = true;
                    }

                    //Está envenenado.
                    if (patient.Poisoned)
                    {
                        //TODO
                        poisonMessage = 1010060;                         // You have failed to cure your target!
                    }
                }
                else                         //TODO Resucitar a los muertos
                {
                    healerMessage  = 500966; //You are unable to resurrect.
                    patientMessage = -1;
                    playSound      = false;
                }

                if (healerMessage != -1)
                {
                    healer.SendLocalizedMessage(healerMessage);
                }

                if (patientMessage != -1)
                {
                    patient.SendLocalizedMessage(patientMessage);
                }

                if (poisonMessage != -1)
                {
                    healer.SendLocalizedMessage(poisonMessage);
                }

                if (playSound)
                {
                    patient.PlaySound(0x57);
                }

                if (tryToObtainBloodyBandage)
                {
                    BloodyBandage.tryObtainBloodyBandage(healer);
                }
            }