Beispiel #1
0
        private void IniSkill()
        {
            this.itemSkill = new PlayerActionSkill();
            SkillTimeTrigger trigger = new SkillTimeTrigger();

            this.itemSkill.SetTrigger(trigger);
            SkillMultiInterrupter inter = new SkillMultiInterrupter();

            inter.inters = new List <ISkillInterrupter>();
            //inter.inters.Add(new SkillKeyInterrupter("5,0,1,2,3,18,23"));

            SkillConditionInterrupter condition = new SkillConditionInterrupter();

            condition.condition = new ExpParaCondition("current.CurHp <= 0");
            inter.inters.Add(condition);

            inter.inters.Add(new PlayerStateInterrupter());

            trigger.SetInterrupter(inter);

            UsingItemAction interAction = new UsingItemAction(true);

            trigger.interAction = interAction;

            UsingItemAction action = new UsingItemAction(false);

            this.itemSkill.SetEffect(action);
        }
Beispiel #2
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.autoMoveInterface.PlayerAutoMove.StopAutoMove();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            itemSkill.inter       = null;
            itemSkill.interAction = null;
            if (ip.key.GetClickSkill() != null)
            {
                PlayerActionSkill skill = ip.key.GetClickSkill() as PlayerActionSkill;
                if (skill != null && skill.inter != null)
                {
                    itemSkill.inter       = skill.inter;
                    itemSkill.interAction = skill.interAction;
                }
            }

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);
            startUse = true;
            SetCurrentItem(ip, (ISkillArgs)args);
            SimpleProto data = FreePool.Allocate();

            data.Key = FreeMessageConstant.PlaySound;
            data.Ks.Add(0);
            data.Ins.Add(FreeUtil.ReplaceInt("{item.itemId}", args));
            fd.Player.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, data);
            PlayerStateUtil.AddPlayerState(EPlayerGameState.UseItem, fd.Player.gamePlay);
        }
Beispiel #3
0
        private static string ToTrigger()
        {
            if (trigger is GameTrigger)
            {
                GameTrigger gt = (GameTrigger)trigger;
                return(string.Format("触发器:{0} 触发类型:{1} 分类:{2} 规则:{3}", gt.GetName(), gt.GetKey(), gt.GetGroup(), gt.GetRule()));
            }
            else if (trigger is string)
            {
                return((string)trigger);
            }
            else if (trigger is FreeEntityData)
            {
                FreeEntityData move = (FreeEntityData)trigger;
                return(string.Format("FreeMove:{0}", move.name));
            }
            else if (trigger is ISkill)
            {
                ISkill skill = (ISkill)trigger;
                string key   = skill.GetKey() != null?skill.GetKey() : string.Empty;

                if (skill is AbstractCoolDownSkill)
                {
                    PlayerActionSkill cooldown     = (PlayerActionSkill)skill;
                    string            skillTrigger = cooldown.trigger != null?cooldown.trigger.ToString() : string.Empty;

                    return(string.Format("动作技能:{0}, 触发:{1}", cooldown.GetKey(), skillTrigger));
                }
                else
                {
                    return(string.Format("技能:{0}", skill.GetKey()));
                }
            }
            else if (trigger is FreeBuf)
            {
                FreeBuf buf = (FreeBuf)trigger;
                return(string.Format("Buf:{0}", buf.GetKey()));
            }

            return(string.Empty);
        }
        public virtual string GetHotKey(IEventArgs args, ItemPosition ip)
        {
            ConditionHotKey result = null;

            args.TempUse("item", ip);
            foreach (ConditionHotKey pk in keys)
            {
                if (pk.Meet(args))
                {
                    result = pk;
                    break;
                }
            }
            args.Resume("item");
            FreeData fd = (FreeData)args.GetUnit("current");

            if (fd != null && result != null)
            {
                fd.GetUnitSkill().RemoveSkill("skill_hotkey_" + result.key);
                PlayerActionSkill skill = new PlayerActionSkill();
                skill.SetKey("skill_hotkey_" + result.key);
                SkillClickTrigger trigger = new SkillClickTrigger();
                trigger.SetKey(int.Parse(result.key));
                skill.SetTrigger(trigger);
                skill.SetEffect(new PositionHotKey.ItemHotkeyAction(this, ip, fd, ip.GetInventory().GetName()));
                fd.GetUnitSkill().AddSkill(skill);
            }
            if (result != null)
            {
                return(result.ui);
            }
            else
            {
                return(string.Empty);
            }
        }