예제 #1
0
        public void ingest_potion(Potion pt, Floor fl, bool repair_over_armor)
        {
            double base_potency = (double)pt.potion_potency() * 1.6;
            if (my_character == Character.Ziktofel)
                base_potency *= 1.6;
            int potency = (int)Math.Ceiling(base_potency);

            bool done = false;
            Armor target_armor = null;

            int head_tally = 0;
            int chest_tally = 0;
            int rarm_tally = 0;
            int larm_tally = 0;
            int lleg_tally = 0;
            int rleg_tally = 0;

            if (pt.get_type() == Potion.Potion_Type.Health)
            {
                while (!done)
                {
                    int target_part = rGen.Next(6);
                    switch (target_part)
                    {
                        case 0:
                            if (!Head.is_uninjured())
                            {
                                Head.heal_via_potion(1);
                                head_tally++;
                                potency--;
                            }
                            break;
                        case 1:
                            if (!Torso.is_uninjured())
                            {
                                Torso.heal_via_potion(1);
                                chest_tally++;
                                potency--;
                            }
                            break;
                        case 2:
                            if (!R_Arm.is_uninjured())
                            {
                                R_Arm.heal_via_potion(1);
                                rarm_tally++;
                                potency--;
                            }
                            break;
                        case 3:
                            if (!L_Arm.is_uninjured())
                            {
                                L_Arm.heal_via_potion(1);
                                larm_tally++;
                                potency--;
                            }
                            break;
                        case 4:
                            if (!R_Leg.is_uninjured())
                            {
                                R_Leg.heal_via_potion(1);
                                rleg_tally++;
                                potency--;
                            }
                            break;
                        case 5:
                            if (!L_Leg.is_uninjured())
                            {
                                L_Leg.heal_via_potion(1);
                                lleg_tally++;
                                potency--;
                            }
                            break;
                    }

                    if (potency == 0)
                        done = true;

                    if (Head.is_uninjured() && Torso.is_uninjured() &&
                        L_Arm.is_uninjured() && L_Leg.is_uninjured() &&
                        R_Arm.is_uninjured() && R_Leg.is_uninjured())
                        done = true;
                }

                //display messages of how many wounds were healed for the player.
                if (head_tally > 0)
                    fl.add_new_popup("+" + head_tally + " Head", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
                if (chest_tally > 0)
                    fl.add_new_popup("+" + chest_tally + " Chest", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
                if (larm_tally > 0)
                    fl.add_new_popup("+" + larm_tally + " LArm", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
                if (rarm_tally > 0)
                    fl.add_new_popup("+" + rarm_tally + " RArm", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
                if (lleg_tally > 0)
                    fl.add_new_popup("+" + lleg_tally + " LLeg", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
                if (rleg_tally > 0)
                    fl.add_new_popup("+" + rleg_tally + " RLeg", Popup.popup_msg_type.Healing, my_grid_coord, false, false);
            }

            calculate_dodge_chance();
            update_pdoll();

            if (pt.get_type() == Potion.Potion_Type.Repair && target_armor != null)
                pt.drink();

            if (pt.get_type() == Potion.Potion_Type.Health)
                pt.drink();
        }
예제 #2
0
        public void heal_via_potion(Potion pt, string bodypart, bool repair_over_armor, Floor fl)
        {
            double potion_potency = (double)pt.potion_potency();
            if (my_character == Character.Ziktofel)
                potion_potency = Math.Ceiling((double)pt.potion_potency() * 1.6);
            int heal_value = (int)potion_potency;

            if (pt.get_type() == Potion.Potion_Type.Health)
            {
                Limb target_limb = null;
                switch (bodypart)
                {
                    case "Head":
                        target_limb = Head;
                        break;
                    case "Chest":
                        target_limb = Torso;
                        break;
                    case "LArm":
                        target_limb = L_Arm;
                        break;
                    case "RArm":
                        target_limb = R_Arm;
                        break;
                    case "LLeg":
                        target_limb = L_Leg;
                        break;
                    case "RLeg":
                        target_limb = R_Leg;
                        break;
                }

                target_limb.heal_via_potion(heal_value);
                fl.add_new_popup("+" + heal_value + " " + target_limb.get_shortname(), Popup.popup_msg_type.Healing, my_grid_coord, false, false);
            }

            calculate_dodge_chance();
            update_pdoll();
            pt.drink();
        }