Esempio n. 1
0
        public static void DrinkHeal_OnCommand(CommandEventArgs e)
        {
            GreaterHealPotion m_GreaterHealPotion = (GreaterHealPotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterHealPotion));
            HealPotion        m_HealPotion        = (HealPotion)e.Mobile.Backpack.FindItemByType(typeof(HealPotion));
            LesserHealPotion  m_LesserHealPotion  = (LesserHealPotion)e.Mobile.Backpack.FindItemByType(typeof(LesserHealPotion));
            int m_Exists   = e.Mobile.Backpack.GetAmount(typeof(GreaterHealPotion));
            int m_Existss  = e.Mobile.Backpack.GetAmount(typeof(HealPotion));
            int m_Existsss = e.Mobile.Backpack.GetAmount(typeof(LesserHealPotion));

            if (m_Exists != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_GreaterHealPotion.OnDoubleClick(e.Mobile);
            }
            else if (m_Existss != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_HealPotion.OnDoubleClick(e.Mobile);
            }
            else if (m_Existsss != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_LesserHealPotion.OnDoubleClick(e.Mobile);
            }
            else
            {
                e.Mobile.SendMessage("Cannot find Heal Potion");
            }
        }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        HealPotion healPotion = other.gameObject.GetComponent <HealPotion>();

        if (healPotion)
        {
            ProcessHeal(healPotion);
        }
    }
Esempio n. 3
0
    private void ProcessHeal(HealPotion healPotion)
    {
        var targetHealth = health.GetHealth() + healPotion.GetHealValue();

        if (targetHealth >= startingHealth)
        {
            targetHealth = startingHealth;
        }

        health.SetHealth(targetHealth);

        healPotion.GetComponent <Destroyable>().playFXAndDestroy();
    }
    // Use this for initialization
    void Start()
    {
        HeavenKey = false;
        TempleEntry.SetActive(false);
        potionEffect = FindObjectOfType <slowPotion>();
        thePlayer    = FindObjectOfType <PlayerController>();
        heal         = FindObjectOfType <HealPotion>();
        Health       = FindObjectOfType <PlayerHealthManager>();

        Player    = GameObject.Find("Player");
        theCamera = FindObjectOfType <Camera>();
        Tijd      = RespawnTimer;
    }
Esempio n. 5
0
        public static void DrinkHeal_OnCommand(CommandEventArgs e)
        {
            // Added to fix the missing check to region. Ugly fix but this script is so ugly anyways. :p
            if (e.Mobile.Region != null && !e.Mobile.Region.OnDoubleClick(e.Mobile, new HealPotion()))
            {
                return;
            }

            LesserHealPotion  lh_potion = (LesserHealPotion)e.Mobile.Backpack.FindItemByType(typeof(LesserHealPotion));
            HealPotion        mh_potion = (HealPotion)e.Mobile.Backpack.FindItemByType(typeof(HealPotion));
            GreaterHealPotion gh_potion = (GreaterHealPotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterHealPotion));

            int lhp = e.Mobile.Backpack.GetAmount(typeof(LesserHealPotion));

            if (lhp != 0)
            {
                e.Mobile.SendMessage("Lesser heal potion found");
                lh_potion.OnDoubleClick(e.Mobile);
                Targeting.Target.Cancel(e.Mobile);
            }
            else
            {
                int mhp = e.Mobile.Backpack.GetAmount(typeof(HealPotion));

                if (mhp != 0)
                {
                    e.Mobile.SendMessage("Heal potion found");
                    mh_potion.OnDoubleClick(e.Mobile);
                    Targeting.Target.Cancel(e.Mobile);
                }
                else
                {
                    int ghp = e.Mobile.Backpack.GetAmount(typeof(GreaterHealPotion));

                    if (ghp != 0)
                    {
                        e.Mobile.SendMessage("Greater heal potion found");
                        gh_potion.OnDoubleClick(e.Mobile);
                        Targeting.Target.Cancel(e.Mobile);
                    }
                    else
                    {
                        e.Mobile.SendMessage("Healing potion not found");
                    }
                }
            }
        }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        GameController gc = new GameController();

        Player     player     = new Player();
        Npc        npc        = new Npc();
        HealPotion healPotion = new HealPotion();
        Fireball   fireball   = new Fireball();

        Point       npcPoint       = new Point(0, 1);
        MoveCommand npcMoveCommand = new MoveCommand(npc, npcPoint);

        gc.setCommand(0, npcMoveCommand);
        AttackCommand npcAttackCommand = new AttackCommand(npc, player);

        gc.setCommand(1, npcAttackCommand);
        SkillCastCommand npcSkillCastCommand = new SkillCastCommand(npc, player, fireball);

        gc.setCommand(2, npcSkillCastCommand);
        ItemUseCommand npcItemUseCommand = new ItemUseCommand(npc, healPotion);

        gc.setCommand(3, npcItemUseCommand);

        Point            playerPoint      = new Point(1, 1);
        MoveCommand      moveCommand      = new MoveCommand(player, playerPoint);
        AttackCommand    attackCommand    = new AttackCommand(player, npc);
        SkillCastCommand skillCastCommand = new SkillCastCommand(player, npc, fireball);
        ItemUseCommand   itemUseCommand   = new ItemUseCommand(player, healPotion);

        Command[]    commands     = { moveCommand, attackCommand, skillCastCommand, itemUseCommand };
        MacroCommand macroCommand = new MacroCommand(commands);

        gc.setCommand(4, macroCommand);

        Debug.Log(gc.ToString());
        gc.onButtonWasPushed(0);
        gc.onButtonWasPushed(1);
        gc.onButtonWasPushed(2);
        gc.onButtonWasPushed(3);
        gc.onButtonWasPushed(4);
        gc.onUndoButtonWasPushed(4);
    }
Esempio n. 7
0
 public ItemUseCommand(Role user, HealPotion potion)
 {
     this.user   = user;
     this.potion = potion;
     effect      = 0;
 }