Exemplo n.º 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;
		}
Exemplo n.º 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);
		}
Exemplo n.º 3
0
		public virtual void removeBuff(IBuffAction buffAction)
		{
			this.buffMap.Remove(buffAction.TypeB);
		}
Exemplo n.º 4
0
		public virtual bool hasSameBuff(IBuffAction buffAction)
		{
			return buffMap.ContainsKey(buffAction.TypeB);
		}
Exemplo n.º 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;
		}
Exemplo n.º 6
0
		protected internal virtual bool hasMaxBuff(IBuffAction buffAction, int maxSize)
		{
			return getBuffCount(buffAction) >= maxSize;
		}
Exemplo n.º 7
0
		public virtual void putHolderMap(IBuffAction buffAction, BuffTypeHolder typeHolder)
		{
			getHolderMap(buffAction)[buffAction.TypeA] = typeHolder;
		}
Exemplo n.º 8
0
		public virtual bool containBuffId(IBuffAction buffAction)
		{
			return containBuffId(buffAction.Id);
		}
Exemplo n.º 9
0
		public virtual BattleFighterBuff getBattleBuff(IBuffAction buffAction)
		{
			return get(buffAction.Id);
		}
Exemplo n.º 10
0
		protected internal virtual bool containTypeA(IBuffAction buffAction)
		{
			bool _containTypeA = false;
			bool _hasTypeAHolder = containTypeAInMap(buffAction);
			if (_hasTypeAHolder)
			{
				_containTypeA = !getBuffTypeHolder(buffAction).Empty;
			}
			return _containTypeA;
		}
Exemplo n.º 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;
		}
Exemplo n.º 12
0
		protected internal virtual bool containTypeAInMap(IBuffAction buffAction)
		{
			return getHolderMap(buffAction).ContainsKey(buffAction.TypeA);
		}
Exemplo n.º 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;
		}
Exemplo n.º 14
0
		protected internal virtual Dictionary<int, BuffTypeHolder> getHolderMap(IBuffAction buffAction)
		{
			return buffAction.Buff ? buffHolderMap : debuffHolderMap;
		}
Exemplo n.º 15
0
		protected internal virtual BattleFighterBuff createBattleFighterBuff(BattleFighter owner, IBuffAction buffAction)
		{
			BattleFighterBuff _buff = new BattleFighterBuff(owner, buffAction);
			return _buff;
		}
Exemplo n.º 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;
		}
Exemplo n.º 17
0
		protected internal virtual BuffPolicyEnum calcPolicy(IBuffAction buffAction)
		{
			return hasSameBuff(buffAction) ? BuffPolicyEnum.COVER : BuffPolicyEnum.OVERLAY;
		}
Exemplo n.º 18
0
		public virtual void createBuffHolder(IBuffAction buffAction)
		{
			BuffTypeHolder _holder = new BuffTypeHolder(buffAction.TypeA);
			putHolderMap(buffAction, _holder);
		}