Example #1
0
 public bool canUseSupply(SupplyType supplyType)
 {
     if (machineState != StateMachine.PLAYER_TURN || playerActions == 0)
     {
         return(false);
     }
     if (supplyType == SupplyType.INJECTION_SPEED || supplyType == SupplyType.INJECTION_ARMOR || supplyType == SupplyType.INJECTION_REGENERATION)
     {
         StatusEffectType type = supplyType.toStatusEffectType();
         foreach (StatusEffect eff in fightScreen.playerStatusEffects)
         {
             if (eff.statusType == type && eff.isFired)
             {
                 Messenger.showMessage("Персонаж уже находится под действием эффекта '" + eff.statusType.name() + "'");
                 return(false);
             }
         }
     }
     else if (supplyType == SupplyType.GRENADE_FLASH || supplyType == SupplyType.GRENADE_PARALIZE)
     {
         StatusEffectType type = supplyType.toStatusEffectType();
         foreach (StatusEffect eff in fightScreen.enemyStatusEffects)
         {
             if (eff.statusType == type && eff.isFired)
             {
                 Messenger.showMessage("Противник уже находится под действием эффекта '" + eff.statusType.name() + "'");
                 return(false);
             }
         }
     }
     return(true);
 }
Example #2
0
        private void _addStatusEffect(object[] args)
        { // addStatusEffect(string partyMemberSelector, StatusEffectType statusEffectType)
            string           partyMemberSelector = (string)args[0];
            StatusEffectType statusEffectType    = (StatusEffectType)args[1];

            StatusEffect statusEffect;

            switch (statusEffectType)
            {
            case StatusEffectType.Poison: statusEffect = new StatusEffects.Poison(); break;

            case StatusEffectType.Paralysis: statusEffect = new StatusEffects.Paralysis(); break;

            case StatusEffectType.Fear: statusEffect = new StatusEffects.Fear(actor); break;

            case StatusEffectType.Doom: statusEffect = new StatusEffects.Doom(actor); break;

            default: statusEffect = null; break;
            }

            if (statusEffect != null)
            {
                PartyMember partyMember = getPartyMemberFromSelector(partyMemberSelector);
                partyMember.AddStatusEffect(statusEffect);
            }
        }
        /// <summary>
        /// Creates a new status effect.
        /// </summary>
        /// <param name="statusEffectType">The type of status effect to link this ability to.</param>
        /// <returns>A status effect builder with the configured options.</returns>
        public StatusEffectBuilder Create(StatusEffectType statusEffectType)
        {
            _activeStatusEffect = new StatusEffectDetail();
            _statusEffects[statusEffectType] = _activeStatusEffect;

            return(this);
        }
Example #4
0
 public StatusEffect(string name, int level, StatusEffectType statusEffectType,
                     bool isBuff, bool isInfinite, bool isStackable, bool isRemovable,
                     float[] degreeArray, Stat amountStat, float[] amountFactorArray, int remainAmount,
                     int remainPhase, int remainStack, int cooldown, bool toBeRemoved,
                     string effectName, EffectVisualType effectVisualType, EffectMoveType effectMoveType)
 {
     this.name              = name;
     this.level             = level;
     this.statusEffectType  = statusEffectType;
     this.isBuff            = isBuff;
     this.isInfinite        = isInfinite;
     this.isStackable       = isStackable;
     this.isRemovable       = isRemovable;
     this.degreeArray       = degreeArray;
     this.amountStat        = amountStat;
     this.amountFactorArray = amountFactorArray;
     this.remainAmount      = remainAmount;
     this.remainPhase       = remainPhase;
     this.remainStack       = remainStack;
     this.cooldown          = cooldown;
     this.toBeRemoved       = toBeRemoved;
     this.effectName        = effectName;
     this.effectVisualType  = effectVisualType;
     this.effectMoveType    = effectMoveType;
 }
    public void Initialize(StatusEffect _o, StatusEffectType _type, Sprite image, String descr)
    {
        o    = _o;
        type = _type;
        effectImage.sprite = image;
        switch (type)
        {
        case StatusEffectType.BLEED:
            timeLeft.color = Color.red;
            if (valueText != null)
            {
                valueText.color = Color.red;
            }
            break;

        case StatusEffectType.ARMOR:
        case StatusEffectType.DEFLECT:
            timeLeft.color = Color.green;
            if (valueText != null)
            {
                valueText.color = Color.green;
            }
            break;
        }
        if (descrText != null)
        {
            descrText.text = descr;
        }
        if (nameText != null)
        {
            nameText.text = type.ToString();
        }
    }
 public void ApplyEffect(StatusEffectType effect, float duration)
 {
     if (enabled)
     {
         networkView.RPC("applyEffect", RPCMode.All, (int)effect, duration);
     }
 }
Example #7
0
        /// <summary>
        /// Checks if a creature has a status effect.
        /// If ignoreExpiration is true, even if the effect is expired this will return true.
        /// This should only be used within this class to avoid confusion.
        /// </summary>
        /// <param name="creature">The creature to check.</param>
        /// <param name="statusEffectType">The status effect type to look for.</param>
        /// <param name="ignoreExpiration">If true, expired effects will return true. Otherwise, expiration will be checked.</param>
        /// <returns>true if creature has status effect, false otherwise</returns>
        private static bool HasStatusEffect(uint creature, StatusEffectType statusEffectType, bool ignoreExpiration)
        {
            // Creature doesn't exist in the cache.
            if (!_creaturesWithStatusEffects.ContainsKey(creature))
            {
                return(false);
            }

            // Status effect doesn't exist for this creature in the cache.
            if (!_creaturesWithStatusEffects[creature].ContainsKey(statusEffectType))
            {
                return(false);
            }

            // Status effect has expired, but hasn't cleaned up yet.
            if (!ignoreExpiration)
            {
                var now = DateTime.UtcNow;
                if (now > _creaturesWithStatusEffects[creature][statusEffectType].Expiration)
                {
                    return(false);
                }
            }

            // Status effect hasn't expired.
            return(true);
        }
Example #8
0
        public void RemoveStatusEffect(StatusEffectType statusEffectType)
        {
            if (log.IsInfoEnabled)
                log.InfoFormat("Remove StatusEffect `{0}`", statusEffectType);

            _statusEffects.Remove(statusEffectType);
        }
Example #9
0
    public bool PassesStatusResistCheck(StatusEffectType inType)
    {
        //can never be turned to stone if asleep
        if (inType == StatusEffectType.STONE && HasStatusEffect(StatusEffectType.SLEEP))
        {
            return(true);
        }

        //ore can't receive any status
        if (isOre)
        {
            return(true);
        }

        //"marked" can't be resisted
        if (inType == StatusEffectType.MARKED)
        {
            return(false);
        }

        //roll a check based on our status resist stat
        long resistChance = stats.Get(Stat.status_resist);

        return(Utils.PercentageChance((int)resistChance));
    }
Example #10
0
        public void AddStatusEffect(StatusEffectType statusEffectType, ushort power, ushort secsLeft)
        {
            if (log.IsInfoEnabled)
                log.InfoFormat("Add StatusEffect `{0}`, power: `{1}`, secsLeft: `{2}`", statusEffectType, power, secsLeft);

            _statusEffects.Add(statusEffectType, power, secsLeft, GetTime());
        }
Example #11
0
 public StatusEffect(StatusType statusType, float value, long removeEffectTimeStamp, StatusEffectType type)
 {
     StatusType            = statusType;
     Value                 = value;
     RemoveEffectTimeStamp = removeEffectTimeStamp;
     Type = type;
 }
Example #12
0
        public static PacketWriter RemoveStatusEffect(StatusEffectType statusEffectType)
        {
            var pw = GetWriter(ServerPacketID.RemoveStatusEffect);

            pw.WriteEnum(statusEffectType);
            return(pw);
        }
Example #13
0
 /// <summary>
 /// Returns the source of a status effect which was applied onto a target creature.
 /// If the status effect cannot be found, OBJECT_INVALID will be returned.
 /// If source cannot be determined, OBJECT_INVALID will be returned.
 /// </summary>
 /// <param name="creature">The creature to check.</param>
 /// <param name="statusEffectType">The status effect type to look for.</param>
 /// <returns>The source of a status effect, or OBJECT_INVALID if it cannot be determined.</returns>
 public static uint GetSource(uint creature, StatusEffectType statusEffectType)
 {
     if (!HasStatusEffect(creature, statusEffectType))
     {
         return(OBJECT_INVALID);
     }
     return(_creaturesWithStatusEffects[creature][statusEffectType].Source);
 }
Example #14
0
        public static Type GetStatusEffect(StatusEffectType type)
        {
            if (!_statusEffects.ContainsKey(type))
            {
                throw new Exception("Status effect not defined: " + type.ToString());
            }

            return(_statusEffects[type]);
        }
Example #15
0
        private void _removeStatusEffect(object[] args)
        { // removeStatusEffect(string partyMemberSelector, StatusEffectType statusEffectType)
            string           partyMemberSelector = (string)args[0];
            StatusEffectType statusEffectType    = (StatusEffectType)args[1];

            PartyMember partyMember = getPartyMemberFromSelector(partyMemberSelector);

            partyMember.RemoveStatusEffect(statusEffectType);
        }
Example #16
0
        public void RemoveStatusEffect(StatusEffectType statusEffectType)
        {
            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Remove StatusEffect `{0}`", statusEffectType);
            }

            _statusEffects.Remove(statusEffectType);
        }
Example #17
0
        public void AddStatusEffect(StatusEffectType statusEffectType, ushort power, ushort secsLeft)
        {
            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Add StatusEffect `{0}`, power: `{1}`, secsLeft: `{2}`", statusEffectType, power, secsLeft);
            }

            _statusEffects.Add(statusEffectType, power, secsLeft, GetTime());
        }
Example #18
0
            /// <summary>
            /// Initializes a new instance of the <see cref="StatusEffectCollectionItem"/> class.
            /// </summary>
            /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to use.</param>
            /// <param name="power">The power of the status effect.</param>
            /// <param name="disableTime">The game time at which this status effect will be disabled.</param>
            public StatusEffectCollectionItem(StatusEffectType statusEffectType, ushort power, int disableTime)
            {
                _statusEffectType = statusEffectType;
                _power            = power;
                _disableTime      = disableTime;

                _statusEffectInfo = StatusEffectInfoManager.Instance.GetAttribute(statusEffectType);
                _grh = new Grh(_statusEffectInfo.Icon);
            }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterStatusEffectTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="power">The initial value for the corresponding property.</param>
 /// <param name="statusEffect">The initial value for the corresponding property.</param>
 /// <param name="timeLeftSecs">The initial value for the corresponding property.</param>
 public CharacterStatusEffectTable(CharacterID @characterID, ActiveStatusEffectID @iD, UInt16 @power,
                                   StatusEffectType @statusEffect, UInt16 @timeLeftSecs)
 {
     CharacterID  = @characterID;
     ID           = @iD;
     Power        = @power;
     StatusEffect = @statusEffect;
     TimeLeftSecs = @timeLeftSecs;
 }
Example #20
0
        public static PacketWriter AddStatusEffect(StatusEffectType statusEffectType, ushort power, uint timeLeft)
        {
            var secsLeft = (ushort)((timeLeft / 1000).Clamp(ushort.MinValue, ushort.MaxValue));

            var pw = GetWriter(ServerPacketID.AddStatusEffect);
            pw.WriteEnum(statusEffectType);
            pw.Write(power);
            pw.Write(secsLeft);
            return pw;
        }
Example #21
0
    public StatusEffect(StatusEffectType inType, int inTurnDuration)
    {
        type         = inType;
        turnDuration = inTurnDuration;

        onlyProcsOnOwnTurn = (inType == StatusEffectType.MARKED);

        turnsActive   = 0;
        statChangeAmt = 0;
    }
Example #22
0
    /// <summary>
    /// Initializes a new instance of the <see cref="StatusEffectEvent"/> class.
    /// </summary>
    /// <param name="srcEntity">Source entity.</param>
    /// <param name="statusEffectProperty">Status effect property.</param>
    /// <param name="statusEventType">Status event type.</param>
    /// <param name="statusType">Status type.</param>
    public StatusEffectEvent(BattleEntity srcEntity, 
	                          StatusEffectProperty statusEffectProperty, 
	                          StatusEventType statusEventType,
	                          StatusEffectType statusType)
    {
        this.SrcEntity = srcEntity;
        this.statusEffectProperty = statusEffectProperty;
        this.statusEventType = statusEventType;
        this.statusType = statusType;
    }
Example #23
0
 public void RemoveStatusEffect(StatusEffectType statusEffectType)
 {
     for (int i = StatusEffects.Count - 1; i >= 0; --i)
     {
         if (StatusEffects[i].Type == statusEffectType)
         {
             StatusEffects.RemoveAt(i);
         }
     }
 }
Example #24
0
 public void RemoveStatusEffect(StatusEffectType set)
 {
     foreach (StatusEffect se in statusEffects)
     {
         if (se.GetEffectType() == set)
         {
             se.SetTimeLeft(0.0f);
         }
     }
 }
 public static IStatusEffect GetStatusEffect(StatusEffectType statusEffectType)
 {
     if (statusEffects.TryGetValue(statusEffectType, out IStatusEffect statusEffect))
     {
         return(statusEffect);
     }
     else
     {
         throw new UnityException("This Status Effect Type has not yet been implemented.");
     }
 }
Example #26
0
    public bool IsOfType(StatusEffectType statusEffectType)
    {
        bool isOfType = false;

        if (statusEffectType.Equals(this.GetStatusEffectType()))
        {
            isOfType = true;
        }

        return(isOfType);
    }
Example #27
0
            public void Add(StatusEffectType statusEffectType, ushort power, ushort secsLeft, TickCount currentTime)
            {
                Remove(statusEffectType);

                var msLeft = secsLeft * 1000;
                var life   = msLeft + currentTime;

                var ase = new StatusEffectCollectionItem(statusEffectType, power, (int)life);

                _statusEffects.Add(ase);
            }
Example #28
0
    public static bool StatusEffectTypeIsNegative(StatusEffectType inType)
    {
        string key = inType.ToString();

        if (effectsAreNegative.ContainsKey(key))
        {
            return(effectsAreNegative[key]);
        }

        throw new System.Exception("Status effect type '" + inType + "' has no definition for it being negative or positive");
    }
Example #29
0
 public bool HasStatusEffectOfType(StatusEffectType statusEffectType)
 {
     foreach (StatusEffect statusEffect in StatusEffects)
     {
         if (statusEffect.Type == statusEffectType)
         {
             return(true);
         }
     }
     return(false);
 }
Example #30
0
    // searching certain StatusEffectType
    public bool HasStatusEffect(StatusEffectType statusEffectType)
    {
        bool hasStatusEffect = false;

        if (statusEffectList.Any(k => k.IsOfType(statusEffectType)))
        {
            hasStatusEffect = true;
        }

        return(hasStatusEffect);
    }
Example #31
0
    public StatusEffect GetStatusEffect(StatusEffectType inType)
    {
        for (int i = 0; i < statusEffects.Count; i++)
        {
            if (statusEffects[i].type == inType)
            {
                return(statusEffects[i]);
            }
        }

        return(null);
    }
Example #32
0
    public int GetActualStat(Stat stat)
    {
        int actualStat = GetStat(stat);
        StatusEffectType statusChange = (StatusEffectType)Enum.Parse(typeof(StatusEffectType), stat.ToString() + "Change");

        // 능력치 증감 효과 적용
        if (this.HasStatusEffect(statusChange))
        {
            actualStat = (int)GetActualEffect(actualStat, statusChange);
        }

        return(actualStat);
    }
        /// <summary>
        /// When overridden in the derived class, tries to get the <see cref="ActiveStatusEffect"/> for a <see cref="StatusEffectType"/>
        /// in this collection.
        /// </summary>
        /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to try to get the <see cref="ActiveStatusEffect"/> of.</param>
        /// <param name="statusEffect">When this method returns true, contains the <see cref="ActiveStatusEffect"/> instance from
        /// this collection for the given <paramref name="statusEffectType"/>.</param>
        /// <returns>True if the <see cref="ActiveStatusEffect"/> of the <paramref name="statusEffectType"/> was found in
        /// this collection; otherwise false.</returns>
        public override bool TryGetStatusEffect(StatusEffectType statusEffectType, out ActiveStatusEffect statusEffect)
        {
            foreach (var activeStatusEffect in this)
            {
                if (activeStatusEffect.StatusEffect.StatusEffectType == statusEffectType)
                {
                    statusEffect = activeStatusEffect;
                    return(true);
                }
            }

            statusEffect = null;
            return(false);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterStatusEffectTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="power">The initial value for the corresponding property.</param>
 /// <param name="statusEffect">The initial value for the corresponding property.</param>
 /// <param name="timeLeftSecs">The initial value for the corresponding property.</param>
 public CharacterStatusEffectTable(CharacterID @characterID, ActiveStatusEffectID @iD, UInt16 @power,
                                   StatusEffectType @statusEffect, UInt16 @timeLeftSecs)
 {
     CharacterID = @characterID;
     ID = @iD;
     Power = @power;
     StatusEffect = @statusEffect;
     TimeLeftSecs = @timeLeftSecs;
 }
        bool TryGetStatusEffect(StatusEffectType statusEffectType, out ASEWithID statusEffect)
        {
            foreach (var item in _statusEffects)
            {
                if (item.Value.StatusEffect.StatusEffectType == statusEffectType)
                {
                    statusEffect = item;
                    return true;
                }
            }

            statusEffect = default(ASEWithID);
            return false;
        }
Example #36
0
 public static PacketWriter RemoveStatusEffect(StatusEffectType statusEffectType)
 {
     var pw = GetWriter(ServerPacketID.RemoveStatusEffect);
     pw.WriteEnum(statusEffectType);
     return pw;
 }
 public bool HasStatusEffectOfType(StatusEffectType statusEffectType)
 {
     foreach (StatusEffect statusEffect in StatusEffects)
     {
         if (statusEffect.Type == statusEffectType)
             return true;
     }
     return false;
 }
 public void RemoveStatusEffect(StatusEffectType statusEffectType)
 {
     for (int i = StatusEffects.Count - 1; i >= 0; --i)
     {
         if (StatusEffects[i].Type == statusEffectType)
             StatusEffects.RemoveAt(i);
     }
 }
Example #39
0
            /// <summary>
            /// Initializes a new instance of the <see cref="StatusEffectCollectionItem"/> class.
            /// </summary>
            /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to use.</param>
            /// <param name="power">The power of the status effect.</param>
            /// <param name="disableTime">The game time at which this status effect will be disabled.</param>
            public StatusEffectCollectionItem(StatusEffectType statusEffectType, ushort power, int disableTime)
            {
                _statusEffectType = statusEffectType;
                _power = power;
                _disableTime = disableTime;

                _statusEffectInfo = StatusEffectInfoManager.Instance.GetAttribute(statusEffectType);
                _grh = new Grh(_statusEffectInfo.Icon);
            }
Example #40
0
 public void Remove(StatusEffectType statusEffectType)
 {
     _statusEffects.RemoveAll(x => x.StatusEffectType == statusEffectType);
 }
Example #41
0
            public void Add(StatusEffectType statusEffectType, ushort power, ushort secsLeft, TickCount currentTime)
            {
                Remove(statusEffectType);

                var msLeft = secsLeft * 1000;
                var life = msLeft + currentTime;

                var ase = new StatusEffectCollectionItem(statusEffectType, power, (int)life);
                _statusEffects.Add(ase);
            }
 public StatusEffect(StatusEffectType type)
 {
     Type = type;
 }
 /// <summary>
 /// When overridden in the derived class, gets if this collection contains a given <see cref="StatusEffectType"/>.
 /// </summary>
 /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to check for.</param>
 /// <returns>True if this collection contains the <paramref name="statusEffectType"/>; otherwise false.</returns>
 public override bool Contains(StatusEffectType statusEffectType)
 {
     return
         _statusEffects.Any(x => _statusEffectTypeComparer.Equals(x.Value.StatusEffect.StatusEffectType, statusEffectType));
 }
 /// <summary>
 /// When overridden in the derived class, gets if this collection contains a given <see cref="StatusEffectType"/>.
 /// </summary>
 /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to check for.</param>
 /// <returns>True if this collection contains the <paramref name="statusEffectType"/>; otherwise false.</returns>
 public override bool Contains(StatusEffectType statusEffectType)
 {
     return _statusEffects.Any(x => x.StatusEffect.StatusEffectType == statusEffectType);
 }
        /// <summary>
        /// When overridden in the derived class, tries to get the <see cref="ActiveStatusEffect"/> for a <see cref="StatusEffectType"/>
        /// in this collection.
        /// </summary>
        /// <param name="statusEffectType">The <see cref="StatusEffectType"/> to try to get the <see cref="ActiveStatusEffect"/> of.</param>
        /// <param name="statusEffect">When this method returns true, contains the <see cref="ActiveStatusEffect"/> instance from
        /// this collection for the given <paramref name="statusEffectType"/>.</param>
        /// <returns>True if the <see cref="ActiveStatusEffect"/> of the <paramref name="statusEffectType"/> was found in
        /// this collection; otherwise false.</returns>
        public override bool TryGetStatusEffect(StatusEffectType statusEffectType, out ActiveStatusEffect statusEffect)
        {
            foreach (var activeStatusEffect in this)
            {
                if (activeStatusEffect.StatusEffect.StatusEffectType == statusEffectType)
                {
                    statusEffect = activeStatusEffect;
                    return true;
                }
            }

            statusEffect = null;
            return false;
        }