Example #1
0
		public BattleFighterBuff(BattleFighter owner, IBuffAction buffAction)
		{
			this.buffAction = buffAction;
			this.owner = owner;
			this.stackingList = new LinkedList<BuffStackInfo>();
			this.paramMap = new Dictionary<int, int>();
			this.permanent = buffAction.CDRound <= 0;
		}
Example #2
0
		/// <summary>
		/// is the buff count max, use when need real add buff, not cover or refresh </summary>
		/// <param name="buffAction">
		/// @return </param>
		public virtual bool hasMaxCountBuff(IBuffAction buffAction)
		{
			if (size() >= BattleConstants.BUFF_MAX_SIZE)
			{
				return false;
			}

			int _maxSize = buffAction.Buff ? BattleConstants.BUFF_MAX_SIZE : BattleConstants.DEBUFF_MAX_SIZE;

			return hasMaxBuff(buffAction, _maxSize);
		}
Example #3
0
		public virtual void removeBuff(IBuffAction buffAction)
		{
			this.buffMap.Remove(buffAction.TypeB);
		}
Example #4
0
		public virtual bool hasSameBuff(IBuffAction buffAction)
		{
			return buffMap.ContainsKey(buffAction.TypeB);
		}
Example #5
0
		protected internal virtual int getBuffCount(IBuffAction buffAction)
		{
			Dictionary<int, BuffTypeHolder> _holderMap = getHolderMap(buffAction);
			int _buffCount = 0;
			foreach (BuffTypeHolder _holder in _holderMap.Values)
			{
				_buffCount += _holder.size();
			}
			return _buffCount;
		}
Example #6
0
		protected internal virtual bool hasMaxBuff(IBuffAction buffAction, int maxSize)
		{
			return getBuffCount(buffAction) >= maxSize;
		}
Example #7
0
		public virtual void putHolderMap(IBuffAction buffAction, BuffTypeHolder typeHolder)
		{
			getHolderMap(buffAction)[buffAction.TypeA] = typeHolder;
		}
Example #8
0
		public virtual bool containBuffId(IBuffAction buffAction)
		{
			return containBuffId(buffAction.Id);
		}
Example #9
0
		public virtual BattleFighterBuff getBattleBuff(IBuffAction buffAction)
		{
			return get(buffAction.Id);
		}
Example #10
0
		protected internal virtual bool containTypeA(IBuffAction buffAction)
		{
			bool _containTypeA = false;
			bool _hasTypeAHolder = containTypeAInMap(buffAction);
			if (_hasTypeAHolder)
			{
				_containTypeA = !getBuffTypeHolder(buffAction).Empty;
			}
			return _containTypeA;
		}
Example #11
0
		protected internal virtual bool hasSameBuff(IBuffAction buffAction)
		{
			bool _contain = true;
			bool _typeA = containTypeA(buffAction);
			_contain = _typeA;
			if (_contain)
			{
				_contain = getBuffTypeHolder(buffAction).hasSameBuff(buffAction);
			}
			return _contain;
		}
Example #12
0
		protected internal virtual bool containTypeAInMap(IBuffAction buffAction)
		{
			return getHolderMap(buffAction).ContainsKey(buffAction.TypeA);
		}
Example #13
0
		public virtual BuffTypeHolder getBuffTypeHolder(IBuffAction buffAction)
		{
			BuffTypeHolder _holder = null;
			//if not contain type, there will be a null point exception in c# code
			if (containTypeAInMap(buffAction))
			{
				_holder = getHolderMap(buffAction)[buffAction.TypeA];
			}
			return _holder;
		}
Example #14
0
		protected internal virtual Dictionary<int, BuffTypeHolder> getHolderMap(IBuffAction buffAction)
		{
			return buffAction.Buff ? buffHolderMap : debuffHolderMap;
		}
Example #15
0
		protected internal virtual BattleFighterBuff createBattleFighterBuff(BattleFighter owner, IBuffAction buffAction)
		{
			BattleFighterBuff _buff = new BattleFighterBuff(owner, buffAction);
			return _buff;
		}
Example #16
0
		protected internal virtual BuffPolicyEnum calcPolicy(IBuffAction buffAction)
		{
			BuffPolicyEnum _policyType = null;
			if (containBuffId(buffAction))
			{
				_policyType = BuffPolicyEnum.STACKING;
			}
			else
			{
				if (containTypeA(buffAction))
				{
					_policyType = getBuffTypeHolder(buffAction).calcPolicy(buffAction);
				}
				else
				{
					_policyType = BuffPolicyEnum.COEXIST;
				}
			}
			return _policyType;
		}
Example #17
0
		protected internal virtual BuffPolicyEnum calcPolicy(IBuffAction buffAction)
		{
			return hasSameBuff(buffAction) ? BuffPolicyEnum.COVER : BuffPolicyEnum.OVERLAY;
		}
Example #18
0
		public virtual void createBuffHolder(IBuffAction buffAction)
		{
			BuffTypeHolder _holder = new BuffTypeHolder(buffAction.TypeA);
			putHolderMap(buffAction, _holder);
		}