Esempio n. 1
0
		/// <summary>
		/// 初始化必要的数据:攻击者动作类型,攻击者初始数据
		/// </summary>
		/// <param name="actType"> </param>
		/// <param name="attacker"> </param>
		/// <param name="fightRecord"> </param>
		public static void initBattleFight(int actType, BattleFighter attacker, BattleFightRecord fightRecord)
		{
			fightRecord.SourceIndex = attacker.Index;
			SingleActionRecord _attackAction = fightRecord.OrCreateAttack;
			_attackAction.ActType = actType;
			initSingleRecord(attacker, _attackAction);
		}
Esempio n. 2
0
		/// <summary>
		/// S1=(武将战斗中攻击力*(1+无双技能加成倍数)-怪物防御力)*伤害加成倍数*弱点加成倍数*带盾减伤倍数*(1-减伤比)*攻击次数
		/// </summary>
		/// <param name="attacker"> </param>
		/// <param name="defencer"> </param>
		/// <param name="fightRecord"> </param>
		public virtual void onAttack(BattleFighter attacker, BattleFighter defencer, BattleFightRecord fightRecord)
		{
			// TODO: afterAttack在其他effect也可能会涉及
			SingleActionRecord _record = initDefenceRecord(defencer, fightRecord);

			float _attack = getAttack(attacker);
			float _spValMuti = this.attackValMuti / BattleConstants.BATTLE_RATIO_BASE;
			float _defence = defencer.Defence;
			float _indexValMuti = calcIndexRatio(attacker);
			float _weakRatio = calcJobWeakValue(attacker, defencer);
			float _damageMuti = calcDamageModify(attacker.DamageMuti);
			float _damageFree = calcDamageModify(defencer.DamageFree);

			_attack = calcSingleDamage(_attack, _defence, _indexValMuti, _spValMuti, _weakRatio, _damageMuti, _damageFree);

			_attack = calcAttackerState(attacker, _attack);

			_attack = calcDefencerState(defencer, _attack);

			float _costHpFloat = _attack * this.hitCount;
			// 四舍五入
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int _costHp = com.kx.sglm.core.util.MathUtils.float2Int(_costHpFloat);
			int _costHp = MathUtils.float2Int(_costHpFloat);

			costHp(_costHp, defencer, _record);

			recordDamageInfo(attacker.Battle, (int) _attack, _record);

			fightRecord.finishCurDefecner();

			Console.WriteLine("Fighter fight costHp " + _costHp);
		}
		/// <summary>
		/// 核心方法,执行技能动作
		/// </summary>
		/// <param name="attacker"> </param>
		/// <param name="record"> </param>
		internal virtual void optionAction(BattleFighter attacker, BattleFightRecord record)
		{
			// 创建一个供不同动作之间数据沟通的记录
			SkillDataHolder _holder = new SkillDataHolder();
			// 动作分两步
			// 准备数据
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<com.kx.sglm.gs.battle.share.actor.impl.BattleFighter> _enemyList = calcTargetList(attacker, true);
			List<BattleFighter> _enemyList = calcTargetList(attacker, true);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<com.kx.sglm.gs.battle.share.actor.impl.BattleFighter> _friendList = calcTargetList(attacker, false);
			List<BattleFighter> _friendList = calcTargetList(attacker, false);
			List<ISkillEffect> _activeEffects = calcActiveEffectByRate();

			_holder.Record = record;
			_holder.Attacker = attacker;
			_holder.EnemyList = _enemyList;
			_holder.FriendList = _friendList;
			_holder.ActiveEffect = _activeEffects;

			// 执行动作内容
			optionEffectAction(_holder);
			// 执行动作后操作
			optionAfterAction(_holder);

		}
Esempio n. 4
0
		protected internal override void initRecord(BattleFighter attacker, BattleFightRecord fightRecord)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.kx.sglm.gs.battle.share.actor.impl.BattleTeam _attackerTeam = attacker.getOwnerTeam();
			BattleTeam _attackerTeam = attacker.getOwnerTeam();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int _targetIndex = _attackerTeam.getIntProp((com.kx.sglm.gs.battle.share.BattleKeyConstants.BATTLE_KEY_HERO_TEAM_TARGET));
			int _targetIndex = _attackerTeam.getIntProp((BattleKeyConstants.BATTLE_KEY_HERO_TEAM_TARGET));
			BattleRecordHelper.initBattleFight(AttackType, attacker, fightRecord);
			SingleActionRecord _attackAction = fightRecord.OrCreateAttack;
			_attackAction.addProp(BattleRecordConstants.SINGLE_ACTION_PROP_ATTACK_TARGET, _targetIndex);
		}
		public override void afterAttack(BattleFightRecord record)
		{
			// TODO Auto-generated method stub

		}
		public override void onAttack(BattleFightRecord fightRecord)
		{
			action(AttackAction, fightRecord);
		}
Esempio n. 7
0
		public abstract void defencerAfterEffect(BattleFighter attacker, List<BattleFighter> defencerList, BattleFightRecord record);
Esempio n. 8
0
		public virtual void attackerAfterSkillAction(BattleFightRecord record)
		{
			skillManager.afterAttack(record);
		}
		protected internal override void initRecord(BattleFighter attacker, BattleFightRecord fightRecord)
		{
			// TODO add record

		}
		public override void afterAttack(BattleFightRecord record)
		{
			// 也许会更换技能
			resetLeftRound();
			recordRound(record.OrCreateAttack);
		}
		protected internal virtual void addExtraCDRound(BattleFightRecord fightRecord)
		{
			// TODO:如果当前没有CD,就不用变了,因为走到#onFightAction方法的时候CD必然是零
			leftRound = curAction.ExtraCD;
			if (!CDZero)
			{
				recordRound(fightRecord.OrCreateAttack);
			}
		}
		public virtual void onAction(BattleFighter attacker, BattleFightRecord record)
		{
			// TODO: 加入后续逻辑
			optionAction(attacker, record);
		}
Esempio n. 13
0
		protected internal abstract void initRecord(BattleFighter attacker, BattleFightRecord fightRecord);
Esempio n. 14
0
		public virtual void onAttack(BattleFightRecord fightRecord)
		{
			skillManager.onAttack(fightRecord);
			buffManager.onAttack(fightRecord);
		}
Esempio n. 15
0
		public virtual void afterDefence(BattleFighter attacker, BattleFightRecord record)
		{
			buffManager.onDefence(attacker, record);
		}
Esempio n. 16
0
		protected internal virtual SingleActionRecord initDefenceRecord(BattleFighter defencer, BattleFightRecord fightRecord)
		{
			SingleActionRecord _singleRecord = fightRecord.OrCreateDefence;
			BattleRecordHelper.initDefencerRecord(defencer, _singleRecord);
			return _singleRecord;
		}
Esempio n. 17
0
		public override void defencerAfterEffect(BattleFighter attacker, List<BattleFighter> defencerList, BattleFightRecord record)
		{
			foreach (BattleFighter _defencer in defencerList)
			{
				_defencer.afterDefence(attacker, record);
			}
		}
		public override void onAttack(BattleFightRecord fightRecord)
		{
			// 假设所有的技能都有额外CD,先更新
			if (!inExtraRound)
			{
				addExtraCDRound(fightRecord);
				InExtraRound = true;
			}
			// 如果当前剩余回合为0,执行动作
			if (CDZero)
			{
				action(curAction, fightRecord);
				InExtraRound = false;
			}

		}
Esempio n. 19
0
		protected internal override void initRecord(BattleFighter attacker, BattleFightRecord fightRecord)
		{
			BattleRecordHelper.initBattleFight(BattleRecordConstants.SINGLE_ACTION_TYPE_RECOVER, attacker, fightRecord);
		}
Esempio n. 20
0
		protected internal override void initRecord(BattleFighter attacker, BattleFightRecord fightRecord)
		{
			BattleFightRecord _record = fightRecord;
			BattleRecordHelper.initBattleFight(BattleRecordConstants.SINGLE_ACTION_TYPE_CHANGE_COLOR, attacker, _record);
		}
Esempio n. 21
0
		public override void defencerAfterEffect(BattleFighter attacker, List<BattleFighter> defencerList, BattleFightRecord record)
		{
			//cur do nothing
		}
Esempio n. 22
0
		public virtual void onDefence(BattleFighter attacker, BattleFightRecord fightRecord)
		{
			HashSet<int> _buffIdSet = new HashSet<int>(allBuffs.Keys);
			foreach (int _buffId in _buffIdSet)
			{
				BattleFighterBuff _buff = allBuffs[_buffId];
				_buff.BuffAction.onDefence(attacker, Owner);
			}
		}