public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
示例#2
0
		public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Check mana and stamina
			if (!this.CheckMana(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Mana"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}
			if (!this.CheckStamina(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Stamina"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			// Use mana/stamina
			this.UseMana(creature, skill);
			this.UseStamina(creature, skill);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
示例#3
0
 public void ActivateSkill(Skill skill, Tile target)
 {
     skill.Activate(this, target);
 }
 private void Enact(Skill skill, GameUnit source, List <GameUnit> targets)
 {
     skill.Activate(source, targets);
     activeSkill = null;
 }
示例#5
0
    void processInput()
    {
        string pressedSkill = "";

        // skill #1
        if (Input.GetKeyDown(KC_SKILL1))
        {
            if (s1.Activate(KeyDownAlpha, true))
            {
                if (!s1.IsSilenced())
                {
                    pressedSkill = "f";
                }
                s1KeyUp = true;
            }
            else
            {
                boopASrc.Play();
            }

            Player.GetComponent <Animator>().SetBool("PlayToggle", true);
        }
        else if (Input.GetKeyUp(KC_SKILL1) && s1KeyUp)
        {
            s1.Deactivate();
            s1KeyUp = false;
        }

        // skill #2
        if (Input.GetKeyDown(KC_SKILL2))
        {
            if (s2.Activate(KeyDownAlpha, false))
            {
                if (!s2.IsSilenced())
                {
                    pressedSkill = "s";
                }
                s2KeyUp = true;
            }
            else
            {
                boopASrc.Play();
            }

            Player.GetComponent <Animator>().SetBool("PlayToggle", true);
        }
        else if (Input.GetKeyUp(KC_SKILL2) && s2KeyUp)
        {
            s2.Deactivate();
            s2KeyUp = false;
        }

        // skill #3
        if (Input.GetKeyDown(KC_SKILL3))
        {
            if (s3.Activate(KeyDownAlpha, false))
            {
                if (!s3.IsSilenced())
                {
                    pressedSkill = "t";
                }
                s3KeyUp = true;
            }
            else
            {
                boopASrc.Play();
            }

            Player.GetComponent <Animator>().SetBool("PlayToggle", true);
        }
        else if (Input.GetKeyUp(KC_SKILL3) && s3KeyUp)
        {
            s3.Deactivate();
            s3KeyUp = false;
        }

        // skill #4
        if (Input.GetKeyDown(KC_SKILL4))
        {
            if (s4.Activate(KeyDownAlpha, false))
            {
                if (!s4.IsSilenced())
                {
                    pressedSkill = "q";
                }
                s4KeyUp = true;
            }
            else
            {
                boopASrc.Play();
            }

            Player.GetComponent <Animator>().SetBool("PlayToggle", true);
        }
        else if (Input.GetKeyUp(KC_SKILL4) && s4KeyUp)
        {
            s4.Deactivate();
            s4KeyUp = false;
        }

        if (!Input.GetKey(KC_SKILL1) && !Input.GetKey(KC_SKILL2) && !Input.GetKey(KC_SKILL3) && !Input.GetKey(KC_SKILL4))
        {
            Player.GetComponent <Animator>().SetBool("PlayToggle", false);
        }

        handleSkillPress(pressedSkill);
    }
示例#6
0
 public void ActivateSkill(Skill skill)
 {
     SetAction(skill.Activate(Controller()));
     DelayedMod();
 }