Ejemplo n.º 1
0
        public void Execute()
        {
            try {
                bool       exec = false;
                InvokeMode mode = InvokeMode.im_ItSelf;

                switch (Action)
                {
                case EffectAction.ea_Instant:
                    // dummy
                    break;

                case EffectAction.ea_Persistent:
                    exec = (Duration == 1);
                    mode = InvokeMode.im_FinAction;
                    break;

                case EffectAction.ea_EachTurn:
                    exec = true;
                    break;

                case EffectAction.ea_RandomTurn:
                    exec = AuxUtils.Chance(10);
                    break;

                case EffectAction.ea_LastTurn:
                    exec = (Duration == 1);
                    break;
                }

                if (exec)
                {
                    EffectID eid = (EffectID)CLSID;

                    if (this is MapEffect)
                    {
                        EffectExt ext = ((MapEffect)this).Ext;
                        InvokeEffect(eid, null, Source, mode, EffectAction.ea_Instant, ext);
                    }
                    else
                    {
                        NWCreature creature   = (NWCreature)Owner;
                        int        lid        = (creature.CurrentField).LandID;
                        bool       LocusValid = (eid == EffectID.eid_Relocation) && creature.IsPlayer && creature.Effects.FindEffectByID(EffectID.eid_LocusMastery) != null && lid != GlobalVars.Land_Valhalla && lid != GlobalVars.Land_Vigrid && lid != GlobalVars.Land_Bifrost && lid != GlobalVars.Land_Nidavellir && lid != GlobalVars.Land_Niflheim && lid != GlobalVars.Land_Ocean;
                        if (LocusValid)
                        {
                            EffectExt ext = new EffectExt();
                            ext.ReqParams = new EffectParams(EffectParams.ep_Place);
                            GlobalVars.nwrWin.InitTarget(EffectID.eid_Relocation, null, mode, ext);
                        }
                        else
                        {
                            creature.UseEffect(eid, Source, mode, null);
                        }
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Effect.execute(): " + ex.Message);
            }
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID) reader.ReadSByte();

            return this;
        }
Ejemplo n.º 3
0
 protected override void ShowAnimation(EffectID animationID) {
     KillAnimationJob();
     switch (animationID) {
         case EffectID.Dying:
             base.ShowAnimation(animationID);
             break;
         case EffectID.Hit:
             base.ShowAnimation(animationID);
             break;
         case EffectID.Attacking:
             ShowAttacking();
             break;
         case EffectID.CmdHit:
             ShowCmdHit();
             break;
         case EffectID.Disbanding:
             ShowDisbanding();
             break;
         case EffectID.Refitting:
             ShowRefitting();
             break;
         case EffectID.Repairing:
             ShowRepairing();
             break;
         case EffectID.None:
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animationID));
     }
 }
Ejemplo n.º 4
0
    public static GameObject Create(EffectID effectID)
    {
        Animator effectObject = null;

        if (effectID == EffectID.Sparksfly)
        {
            effectObject = Create("Sparksfly");
        }
        else if (effectID == EffectID.Vanishes)
        {
            effectObject = Create("Vanishes");
        }
        else
        {
            Debug.LogError("not match EffectID id: " + effectID);
        }

        float    effectLength = effectObject.GetCurrentAnimatorStateInfo(0).length;
        Sequence sequence     = DOTween.Sequence();

        sequence.AppendInterval(effectLength);
        sequence.AppendCallback(() => GameObject.Destroy(effectObject.gameObject));
        sequence.Play();

        return(effectObject.gameObject);
    }
Ejemplo n.º 5
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID)reader.ReadSByte();

            return(this);
        }
Ejemplo n.º 6
0
    public static bool Rect(this EffectID ID)
    {
        bool isRect = false;

        switch (ID)
        {
        case EffectID.CheckPoint:
            isRect = false;
            break;

        case EffectID.ClearEffect:
            isRect = false;
            break;

        case EffectID.Console:
            isRect = true;
            break;

        case EffectID.DestoryEnemy:
            isRect = false;
            break;

        case EffectID.DestoryObj:
            isRect = false;
            break;

        case EffectID.EnemyDistinction:
            isRect = false;
            break;

        case EffectID.EnemyRecovery:
            isRect = true;
            break;

        case EffectID.EnemyRespown:
            isRect = false;
            break;

        case EffectID.GoalPoint:
            isRect = false;
            break;

        case EffectID.LookOn:
            isRect = true;
            break;

        case EffectID.Numparent:
            isRect = false;
            break;

        case EffectID.ParticleLight:
            isRect = false;
            break;

        case EffectID.Wave:
            isRect = false;
            break;
        }
        return(isRect);
    }
Ejemplo n.º 7
0
 public SkillRec(int name, SkillKind kinds, string gfx, EffectID effect)
 {
     Name       = name;
     Kinds      = kinds;
     Gfx        = gfx;
     Effect     = effect;
     ImageIndex = -1;
 }
Ejemplo n.º 8
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID) reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return this;
        }
Ejemplo n.º 9
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID)reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data     = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return(this);
        }
Ejemplo n.º 10
0
 public Effect(GameSpace space, object owner, EffectID eID, object source, EffectAction actionKind, int duration, int magnitude)
     : base(space, owner)
 {
     CLSID     = (int)eID;
     Action    = actionKind;
     Duration  = duration;
     Magnitude = magnitude;
     Source    = source;
 }
Ejemplo n.º 11
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID      = reader.ReadVarInt();
            EffectID      = (EffectID)reader.ReadSByte();
            Amplifier     = reader.ReadSByte();
            Duration      = reader.ReadVarInt();
            HideParticles = reader.ReadBoolean();

            return(this);
        }
Ejemplo n.º 12
0
    /// <summary>
    /// Effect再生
    /// </summary>
    /// <param name="_id">Effect ID</param>
    /// <param name="_pos">再生場所</param>
    public void PlayEffect(EffectID _id, Vector3 _pos)
    {
        var data = m_effectDatas.Find(dt => dt.ID == _id);

        if (data == null)
        {
            Debug.LogError(_id + " object isn't registered.");
        }
        Instantiate(data.EffectObj, _pos, quaternion.identity);
    }
Ejemplo n.º 13
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID) reader.ReadSByte();
            Amplifier = reader.ReadSByte();
            Duration = reader.ReadVarInt();
            HideParticles = reader.ReadBoolean();

            return this;
        }
Ejemplo n.º 14
0
        public static SkillRec Create(int name, SkillKind kinds, string gfx, EffectID effect)
        {
            SkillRec result = new SkillRec();

            result.Name       = name;
            result.Kinds      = kinds;
            result.gfx        = gfx;
            result.Effect     = effect;
            result.ImageIndex = -1;
            return(result);
        }
Ejemplo n.º 15
0
        public virtual void InitByEffect(EffectID effectID)
        {
            int       eid    = (int)effectID;
            EffectRec effRec = EffectsData.dbEffects[eid];

            if (effRec.FrameCount > 0)
            {
                AnimKind     = effRec.AnimationKind;
                ImagesOrigin = effRec.ImageIndex;
                FramesCount  = (int)effRec.FrameCount;
            }
        }
Ejemplo n.º 16
0
        public override void UseEffect(EffectID effectID, object source, InvokeMode invokeMode, EffectExt ext)
        {
            bool paramsValid = Effect.InitParams(effectID, this, source, invokeMode, ref ext);

            if (paramsValid)
            {
                base.UseEffect(effectID, source, invokeMode, ext);
            }
            else
            {
                GlobalVars.nwrWin.InitTarget(effectID, source, invokeMode, ext);
            }
        }
Ejemplo n.º 17
0
 public PlaceRec(int name, string imageName, SymbolID symbol,
                 PlaceFlags signs, Movements movements, int subTiles, EffectID effect)
 {
     NameRS     = name;
     ImageName  = imageName;
     Symbol     = symbol;
     Signs      = signs;
     Moves      = movements;
     SubTiles   = subTiles;
     Effect     = effect;
     ImageIndex = -1;
     SubsLoaded = 0;
 }
Ejemplo n.º 18
0
 protected virtual void ShowAnimation(EffectID animationID) {
     KillAnimationJob();
     switch (animationID) {
         case EffectID.Dying:
             ShowDying();
             break;
         case EffectID.Hit:
             ShowHit();
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animationID));
     }
 }
Ejemplo n.º 19
0
        public static void InvokeEffect(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, EffectAction action, EffectExt ext)
        {
            if (effectID == EffectID.eid_None)
            {
                return;
            }

            try {
                if (creature != null)
                {
                    GameEvent @event = new GameEvent(GameSpace.Instance, null);
                    @event.CLSID = (int)effectID;
                    @event.SetPos(creature.PosX, creature.PosY);
                    GlobalVars.nwrWin.DoEvent(EventID.event_EffectSound, null, null, @event);
                    @event.Dispose();
                }

                ItemState state;
                if (source != null && source is Item)
                {
                    state = ((Item)source).State;
                }
                else
                {
                    state = ItemState.is_Normal;
                }

                bool valid = (ext == null || ext.Valid);
                if (valid)
                {
                    IEffectProc proc = EffectsData.dbEffectProcs[(int)effectID].Proc;
                    if (proc != null)
                    {
                        proc.Invoke(effectID, (NWCreature)creature, source, state, invokeMode, ext);
                    }
                }
            } catch (Exception ex) {
                //EffectsData.dbEffects[(int)effectID]
                string msg = "Effect.invokeEffect(): " + effectID.ToString();
                if (creature != null)
                {
                    msg = msg + "/" + ((NWCreature)creature).Entry.Sign;
                }
                if (source != null && source is Item)
                {
                    msg = msg + "/" + ((Item)source).Entry.Sign;
                }
                msg = msg + ", " + ex.Message;
                Logger.Write(msg);
            }
        }
Ejemplo n.º 20
0
 protected override void Parse(EndianBinaryReader r)
 {
     EffectID  = (SoundEffects)r.ReadInt32();
     Position  = CoordInt.Read(r);
     SoundData = r.ReadInt32();
     SoundByte = r.ReadByte();
     //Debug.WriteLine(DebugPacket.Read(r));
     #if DEBUGPACKET
     if (EffectID.ToString() == ((int)EffectID).ToString())
     {
         throw new NotImplementedException(EffectID.ToString());
     }
     #endif
 }
Ejemplo n.º 21
0
        public Effect FindEffectByID(EffectID eid)
        {
            int num = Count;

            for (int i = 0; i < num; i++)
            {
                Effect ef = GetItem(i);
                if (ef.CLSID == (int)eid)
                {
                    return(ef);
                }
            }

            return(null);
        }
Ejemplo n.º 22
0
    public static EffectController PlayEffect(EffectID effectID, Vector3 pos)
    {
        foreach (var effect in instance.effectPoolList[effectID])
        {
            if (effect.IsActive())
            {
                continue;
            }

            effect.Play(pos);
            return(effect);
        }

        return(null);
    }
Ejemplo n.º 23
0
        //エフェクト生成(作るだけ,破壊時間指定)
        public virtual GameObject CreateEffect(EffectID name, float time)
        {
            //空オブジェ作成
            GameObject effectObj;
            //エフェクト番号に変換
            int effectNum = (int)name;

            //エフェクトをリストから複製
            effectObj = Instantiate(_effects[effectNum]);
            //親の設定
            SetParent(effectObj, name);
            //自己破壊セット
            SetDestroy(effectObj, time);

            return(effectObj);
        }
Ejemplo n.º 24
0
        public static bool InitParams(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, ref EffectExt refExt)
        {
            if (refExt == null)
            {
                refExt = new EffectExt();
            }

            refExt.ReqParams = EffectsData.dbEffects[(int)effectID].ReqParams;
            ICheckProc proc = EffectsData.dbEffectProcs[(int)effectID].Check;

            if (proc != null)
            {
                proc.Invoke(effectID, (NWCreature)creature, source, invokeMode, refExt);
            }

            return(refExt.Valid);
        }
Ejemplo n.º 25
0
    public void Make(EffectID effectID, Vector2 pos, int size, float interval, int loop)
    {
        List <Sprite> imageList = _imageList[(int)effectID].List;

        GameObject effectPrefab = (GameObject)Resources.Load("Prefabs/EffectObject");
        GameObject effect       = (GameObject)Instantiate(effectPrefab);
        Effect     effectScript = effect.GetComponent <Effect>();

        effectScript.SetPos(pos);
        effectScript.SetSize(size);
        effectScript.SetInterval(interval);
        effectScript.SetImageList(imageList);
        effectScript.SetMax(imageList.Count);
        effectScript.SetLoop(loop);

        effect.transform.SetParent(_parentGameObject.transform);
    }
Ejemplo n.º 26
0
        public void Execute()
        {
            try {
                for (int i = Count - 1; i >= 0; i--)
                {
                    Effect eff = GetItem(i);

                    eff.Execute();

                    if (eff.Action != EffectAction.ea_Instant)
                    {
                        if (eff.Duration > 0)
                        {
                            int      oldDuration = eff.Duration;
                            EffectID eid         = (EffectID)eff.CLSID;

                            EffectFlags flags = EffectsData.dbEffects[(int)eid].Flags;
                            if (flags.Contains(EffectFlags.ep_Decrease))
                            {
                                eff.Duration--;
                            }
                            else if (flags.Contains(EffectFlags.ep_Increase))
                            {
                                eff.Duration++;
                            }

                            eff.Magnitude = (int)Math.Round((float)eff.Magnitude * ((float)eff.Duration / (float)oldDuration));

                            if (eff.Source == null && eff.Duration == 0)
                            {
                                // e_Prowling has change effects list,
                                // so we need check current effect
                                // its hack and bad code!
                                if (GetItem(i) == eff)
                                {
                                    Delete(i);
                                }
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                Logger.Write("EffectsList.execute(): " + ex.Message);
            }
        }
Ejemplo n.º 27
0
        //エフェクト生成(親指定)
        public virtual GameObject CreateEffect(EffectID name, GameObject parent)
        {
            //空オブジェ作成
            GameObject effectObj;
            //エフェクト番号に変換
            int effectNum = (int)name;

            //エフェクトをリストから複製
            effectObj = Instantiate(_effects[effectNum]);
            //親の設定
            SetParent(effectObj, name, parent);
            //エフェクトの位置設定
            effectObj.transform.position = parent.transform.position;
            //自己破壊セット
            SetDestroy(effectObj);

            return(effectObj);
        }
Ejemplo n.º 28
0
        //エフェクト生成(対象エフェクト,親指定,オフセット指定,生存時間設定)
        public virtual GameObject CreateEffect(EffectID name, GameObject parent, Vector3 offSet, float time)
        {
            //空オブジェ作成
            GameObject effectObj;
            //エフェクト番号に変換
            int effectNum = (int)name;

            //エフェクトをリストから複製
            effectObj = Instantiate(_effects[effectNum]);
            //親の設定
            SetParent(effectObj, name, parent);
            //オフセット分位置をずらす
            effectObj.transform.position = parent.transform.position + offSet;
            //自動破壊セット
            SetDestroy(effectObj);

            return(effectObj);
        }
Ejemplo n.º 29
0
 //親の設定(子供になるオブジェクト,セットするエフェクトID,親になるオブジェクト)
 public virtual void SetParent(GameObject obj, EffectID name, GameObject parent)
 {
     //エフェクトがRectTransform仕様でなければ
     if (name.Rect() == false)
     {
         //指定した親の子供にする
         obj.transform.SetParent(parent.transform);
         //ヒエラルキーの一番上に置く
         obj.transform.SetAsFirstSibling();
     }
     else
     {
         //UIRootに置く
         obj.transform.SetParent(InGameManager.Instance.UIRoot.gameObject.transform);
         //ヒエラルキーの一番上に置く(最背面描画)
         obj.transform.SetAsFirstSibling();
     }
 }
Ejemplo n.º 30
0
        //エフェクト生成(作るだけ,位置指定)
        public virtual GameObject CreateEffect(EffectID name, Vector3 pos)
        {
            //空オブジェ作成
            GameObject effectObj;
            //エフェクト番号に変換
            int effectNum = (int)name;

            //エフェクトをリストから複製
            effectObj = Instantiate(_effects[effectNum]);
            effectObj.SetActive(false);
            //親の設定
            SetParent(effectObj, name);
            //エフェクトの位置設定
            effectObj.transform.position = pos;
            //自己破壊セット
            SetDestroy(effectObj);

            effectObj.SetActive(true);

            return(effectObj);
        }
Ejemplo n.º 31
0
        public static int GetDuration(EffectID effectID, ItemState state, bool Inv)
        {
            if (Inv)
            {
                if (state != ItemState.is_Blessed)
                {
                    if (state == ItemState.is_Cursed)
                    {
                        state = ItemState.is_Blessed;
                    }
                }
                else
                {
                    state = ItemState.is_Cursed;
                }
            }
            MNXRange r = EffectsData.dbEffects[(int)effectID].Duration;
            float    f = StaticData.dbItemStates[(int)state].Factor;

            return(RandomHelper.GetBoundedRnd((int)((long)Math.Round(((double)r.Min * (double)f))), (int)((long)Math.Round(((double)r.Max * (double)f)))));
        }
Ejemplo n.º 32
0
 //親の設定(子供になるオブジェクト,セットするエフェクトID)
 public virtual void SetParent(GameObject obj, EffectID name)
 {
     //エフェクトがRectTransform仕様でなければ
     if (name.Rect() == false)
     {
         //エフェクト置き場に置く
         if (_effectPlace)
         {
             obj.transform.SetParent(_effectPlace.transform);
             //ヒエラルキーの一番上に置く
             obj.transform.SetAsFirstSibling();
         }
     }
     else
     {
         //UIRootに置く
         obj.transform.SetParent(InGameManager.Instance.UIRoot.gameObject.transform);
         //ヒエラルキーの一番上に置く(最背面描画)
         obj.transform.SetAsFirstSibling();
     }
 }
 public override int RemoveEffect(EffectID eid)
 {
     int num = effects[eid.Priority].RemoveAll(node => node.ID == eid);
     count -= num;
     return num;
 }
Ejemplo n.º 34
0
 public MapEffect(GameSpace space, object owner, EffectID eID, object source, EffectAction actionKind, int duration, int magnitude)
     : base(space, owner, eID, source, actionKind, duration, magnitude)
 {
     Ext = null;
 }
Ejemplo n.º 35
0
 protected void OnStopAnimation(EffectID animation) {
     if (onStopAnimation != null) {
         onStopAnimation(animation);
     }
 }
Ejemplo n.º 36
0
 public void Stop(EffectID animationID) {
     KillAnimationJob();
     //D.Warn("No Animation named {0} to stop.", animation.GetName());   // Commented out as most show Jobs not yet implemented
 }
Ejemplo n.º 37
0
 public void Start(EffectID animationID) {
     ShowAnimation(animationID);
 }
Ejemplo n.º 38
0
 public void ShowAnimation(EffectID animation) {
     switch (animation) {
         case EffectID.Dying:
             ShowDying();
             break;
         case EffectID.Hit:
             ShowHit();
             break;
         case EffectID.Attacking:
             ShowAttacking();
             break;
         case EffectID.CmdHit:
             ShowCmdHit();
             break;
         case EffectID.Disbanding:
             ShowDisbanding();
             break;
         case EffectID.Refitting:
             ShowRefitting();
             break;
         case EffectID.Repairing:
             ShowRepairing();
             break;
         case EffectID.None:
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animation));
     }
 }
        public override int RemoveEffect(EffectID eid)
        {
            EffectRemoveListener();
#if DEBUG
            NotSupported.Throw("Non-Effect Property");
#endif
            return 0;
        }
Ejemplo n.º 40
0
        public static int GetMagnitude(EffectID effectID)
        {
            MNXRange r = EffectsData.dbEffects[(int)effectID].Magnitude;

            return(RandomHelper.GetBoundedRnd(r.Min, r.Max));
        }
 public override int RemoveEffect(EffectID eid)
 {
     int num = effectList.RemoveEffect(eid);
     Invalidate();
     return num;
 }
Ejemplo n.º 42
0
 public void StopAnimation(EffectID animation) {
     if (_showingJob != null && _showingJob.IsRunning) {
         _showingJob.Kill();
     }
 }
Ejemplo n.º 43
0
        public void Exec(NWCreature creature, EffectID effectID, InvokeMode invokeMode, EffectExt ext, string rayMsg)
        {
            GlobalVars.nwrWin.ShowText(creature, rayMsg);

            int          i      = Effect.GetMagnitude(effectID);
            EffectTarget target = EffectTarget.et_None;

            if ((ext.ReqParams.Contains(EffectParams.ep_Direction)))
            {
                target = EffectTarget.et_Direction;
            }
            else
            {
                if ((ext.ReqParams.Contains(EffectParams.ep_Creature)))
                {
                    target = EffectTarget.et_Creature;
                }
            }
            int x;
            int y;
            int x2;
            int y2;

            if (target != EffectTarget.et_Direction)
            {
                if (target != EffectTarget.et_Creature)
                {
                    return;
                }
                x = creature.PosX;
                y = creature.PosY;
                NWCreature extCr = (NWCreature)ext.GetParam(EffectParams.ep_Creature);
                x2 = extCr.PosX;
                y2 = extCr.PosY;
                int dir = Directions.GetDirByCoords(x, y, x2, y2);
                x += Directions.Data[dir].DX;
                y += Directions.Data[dir].DY;
            }
            else
            {
                int dir = (int)ext.GetParam(EffectParams.ep_Direction);
                x  = creature.PosX + Directions.Data[dir].DX;
                y  = creature.PosY + Directions.Data[dir].DY;
                x2 = x + Directions.Data[dir].DX * i;
                y2 = y + Directions.Data[dir].DY * i;
            }
            Creature = creature;
            Dir      = Directions.GetDirByCoords(x, y, x2, y2);
            EffID    = effectID;

            Field = Creature.CurrentField;

            int       eid    = (int)effectID;
            EffectRec effRec = EffectsData.dbEffects[eid];

            if (effRec.FrameCount > 0)
            {
                MapObject = new MapObject(creature.Space, Field);
                MapObject.InitByEffect(effectID);
                Field.Features.Add(MapObject);
            }
            else
            {
                MapObject = null;
            }

            TargetMeeted = AuxUtils.DoLine(x, y, x2, y2, LineProc, true);

            if (MapObject != null)
            {
                Field.Features.Remove(MapObject);
            }
        }
Ejemplo n.º 44
0
 public abstract int RemoveEffect(EffectID eid);