public bool CanBeHit(AttackUnit aut) { bool hasInSuper = _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_SUPER_SAIYAJIN); bool hasInSuper2 = _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_SUPER_SAIYAJIN2); bool hasInGod = _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_GOD); if (_owner.ACOwner.IsAlived && !hasInSuper && !hasInSuper2 && !hasInGod) { aut.GetHurtDirection(_owner.ACOwner.ThisTransform, ref _hitDirection); //Debug.Log("GetHurtDirection = " + _hitDirection); return(true); } else { if (_owner.ACOwner._onHit != null) { _owner.ACOwner._onHit((int)LevelManager.VarNeedCount.ATTACK_IGNORE); } } Debug.Log(string.Format("InSuper = {0}, InSuper2 = {1}, InGod = {2}", hasInSuper, hasInSuper2, hasInGod)); return(false); }
public void AttackTarget(Unit defender) { Controller.AttackingWith = this; var attackUnit = new AttackUnit(this, defender, History); History.Add(new DeclareAttack(this, defender, attackUnit)); }
public void IsHitSomeone(ActionController owner, AttackUnit attackUnit, FC_DAMAGE_TYPE damageType, ActionController target) { HandleHitTarget.HandleHit(owner, attackUnit, damageType, target); _curBombPosition = BOMB_POSITION.AT_HIT_TARGET; if (_shakePos == SHAKE_POS.AT_HIT_TARGET) { CameraController.Instance.StartCameraEffect(EnumCameraEffect.none, _shakeLevel, false); } }
void AttackStart() { //boxCollider.enabled = true; GameObject missiles = Instantiate(shell, missilePos.transform.position, Quaternion.identity); Rigidbody shellRb = missiles.GetComponent <Rigidbody>(); AttackUnit unit = missiles.GetComponent <AttackUnit>(); unit.SetAttackPower = unitController.GetAttackPower; shellRb.AddForce(transform.forward * speed); }
private void MouseButtonUp() { if (attackingNode != null && attackedNode != null) { var attackUnitsCount = attackingNode.SendAttackGroup(); for (int i = 0; i < attackUnitsCount; i++) { var spawnPos = attackingNode.transform.position + (Vector3)Random.insideUnitCircle; spawnPos.z = 0f; AttackUnit attackUnit = Instantiate(attackUnitPrefab, spawnPos, Quaternion.identity); attackUnit.SetAim(attackedNode); } int attackingIndex = 0; int attackedIndex = 0; for (int i = 0; i < FightNode.fightNodes.Count; i++) { if (attackingNode == FightNode.fightNodes[i]) { attackingIndex = i; } if (attackedNode == FightNode.fightNodes[i]) { attackedIndex = i; } } actionsSequence.Add(attackingIndex); actionsSequence.Add(attackedIndex); } if (attackingNode != null) { attackingNode.Select(false); attackingNode = null; } if (attackedNode != null) { attackedNode.Select(false); attackedNode = null; } connectionLine.gameObject.SetActive(false); }
/// <summary> /// 获取攻击单位 /// </summary> /// <param name="position">攻击方的位置</param> /// <param name="attackType">攻击方式</param> /// <param name="attackTaget">攻击目标</param> /// <param name="targetEmbattle"></param> private static CombatGeneral[] GetTargetUnit(int position, AttackUnit attackType, AttackTaget attackTaget, EmbattleQueue targetEmbattle) { IGeneral[] generalList = new IGeneral[0]; List <CombatGeneral> targetGeneralList = new List <CombatGeneral>(); switch (attackType) { case AttackUnit.Single: CombatGeneral cg = null; if (attackTaget == AttackTaget.Self) { cg = (CombatGeneral)targetEmbattle.GetGeneral(position); } else { cg = (CombatGeneral)targetEmbattle.FindGeneral(position); } if (cg != null) { generalList = new IGeneral[] { cg }; } break; case AttackUnit.Horizontal: generalList = targetEmbattle.FindHorizontal(position); break; case AttackUnit.Vertical: generalList = targetEmbattle.FindVertical(position); break; case AttackUnit.All: generalList = targetEmbattle.FindAll(); break; default: break; } foreach (IGeneral general in generalList) { targetGeneralList.Add((CombatGeneral)general); } return(targetGeneralList.ToArray()); }
/// <summary> /// 获取攻击目标阵营 /// </summary> /// <param name="targerHandle"></param> /// <param name="role"></param> /// <returns></returns> public CombatGeneral[] GetTargetRoleUnit(TargetHandle targerHandle, EmbattleRole role) { AttackTaget attackTaget; AttackUnit attackUnit = GetAttackUnit(); if (General.IsHunluanStatus) { attackTaget = AttackTaget.Friendly; } else { attackTaget = GetAttackTaget(); } ProcessLog.AttackUnit = attackUnit; ProcessLog.AttackTaget = attackTaget; EmbattleQueue attackEmbattle; switch (attackTaget) { case AttackTaget.Self: case AttackTaget.Friendly: attackEmbattle = targerHandle(role); break; case AttackTaget.Enemy: attackEmbattle = targerHandle(role == EmbattleRole.RoleA ? EmbattleRole.RoleD : EmbattleRole.RoleA); break; default: throw new Exception("未能找到攻击目标"); //break; } TagetRole = attackEmbattle.Role; if (General.IsHunluanStatus) { var rgeneral = (CombatGeneral)attackEmbattle.RandomGeneral(); return(new[] { rgeneral }); } return(GetTargetUnit(General.Position, attackUnit, attackTaget, attackEmbattle)); }
protected override object this[string index] { get { #region switch (index) { case "AbilityID": return(AbilityID); case "AbilityName": return(AbilityName); case "AttackType": return(AttackType); case "AbilityProperty": return(AbilityProperty); case "AttackUnit": return(AttackUnit); case "AttackTaget": return(AttackTaget); case "RatioNum": return(RatioNum); case "IsIncrease": return(IsIncrease); case "HitPercent": return(HitPercent); case "IsCorrect": return(IsCorrect); case "IsIncreaseCorrect": return(IsIncreaseCorrect); case "AbilityType": return(AbilityType); case "BaseEffectNum": return(BaseEffectNum); case "IncreaseNum": return(IncreaseNum); case "EffectCount": return(EffectCount); case "RatioIncreaseNum": return(RatioIncreaseNum); case "EffectDesc": return(EffectDesc); case "AbilityDesc": return(AbilityDesc); case "IsMove": return(IsMove); case "EffectID1": return(EffectID1); case "EffectID2": return(EffectID2); case "Version": return(Version); case "AbilityStyle": return(AbilityStyle); case "HeadID": return(HeadID); case "DemandLv": return(DemandLv); case "ChangeAbility": return(ChangeAbility); case "AfterAbility": return(AfterAbility); case "MaxHeadID": return(MaxHeadID); case "Probability": return(Probability); case "FntHeadID": return(FntHeadID); case "IsActive": return(IsActive); case "AbilityQuality": return(AbilityQuality); default: throw new ArgumentException(string.Format("AbilityInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "AbilityID": _AbilityID = value.ToInt(); break; case "AbilityName": _AbilityName = value.ToNotNullString(); break; case "AttackType": _AttackType = value.ToEnum <AttackType>(); break; case "AbilityProperty": _AbilityProperty = value.ToEnum <AbilityProperty>(); break; case "AttackUnit": _AttackUnit = value.ToEnum <AttackUnit>(); break; case "AttackTaget": _AttackTaget = value.ToEnum <AttackTaget>(); break; case "RatioNum": _RatioNum = value.ToDecimal(); break; case "IsIncrease": _IsIncrease = value.ToBool(); break; case "HitPercent": _HitPercent = value.ToDecimal(); break; case "IsCorrect": _IsCorrect = value.ToBool(); break; case "IsIncreaseCorrect": _IsIncreaseCorrect = value.ToBool(); break; case "AbilityType": _AbilityType = value.ToNotNullString(); break; case "BaseEffectNum": _BaseEffectNum = value.ToNotNullString(); break; case "IncreaseNum": _IncreaseNum = value.ToNotNullString(); break; case "EffectCount": _EffectCount = value.ToShort(); break; case "RatioIncreaseNum": _RatioIncreaseNum = value.ToDecimal(); break; case "EffectDesc": _EffectDesc = value.ToNotNullString(); break; case "AbilityDesc": _AbilityDesc = value.ToNotNullString(); break; case "IsMove": _IsMove = value.ToBool(); break; case "EffectID1": _EffectID1 = value.ToNotNullString(); break; case "EffectID2": _EffectID2 = value.ToNotNullString(); break; case "Version": _Version = value.ToInt(); break; case "AbilityStyle": _AbilityStyle = value.ToShort(); break; case "HeadID": _HeadID = value.ToNotNullString(); break; case "DemandLv": _DemandLv = value.ToShort(); break; case "ChangeAbility": _ChangeAbility = value.ToEnum <AbilityType>(); break; case "AfterAbility": _AfterAbility = value.ToEnum <AbilityType>(); break; case "MaxHeadID": _MaxHeadID = value.ToNotNullString(); break; case "Probability": _Probability = value.ToDecimal(); break; case "FntHeadID": _FntHeadID = value.ToNotNullString(); break; case "IsActive": _IsActive = value.ToShort(); break; case "AbilityQuality": _AbilityQuality = value.ToInt(); break; default: throw new ArgumentException(string.Format("AbilityInfo index[{0}] isn't exist.", index)); } #endregion } }
public AttackHitType GetHitType(AttackUnit aut, int realDamage, int currentHP) { AttackInfo aif = aut.GetAttackInfo(); AttackHitType eht = aif._hitType; #if xingtianbo //if(eht > AttackHitType.BLEND_HURT) //{ // eht = eht - AttackHitType.BLEND_HURT + AttackHitType.Normal; //} //else if(eht > AttackHitType.NORMAL_HURT) //{ // eht = eht - AttackHitType.NORMAL_HURT + AttackHitType.Normal; //} #endif if (!_canBeHitDown) { eht = AttackHitType.KnockBack; } if (_owner.IsOnParry == FC_PARRY_EFFECT.FAIL) { eht = AttackHitType.ParryFail; _owner.IsOnParry = FC_PARRY_EFFECT.NONE; } #if xingtianbo //if(eht == AttackHitType.Normal) //{ // eht = AttackHitType.HURT_NORMAL; //} #endif AttackHitType expectHitType = _currentHitType; if (_nextHitType != AttackHitType.None) { expectHitType = _nextHitType; } if (eht >= AttackHitType.HurtNormal && realDamage >= currentHP) { if (currentHP > 0 && expectHitType != AttackHitType.Dizzy && expectHitType != AttackHitType.KnockDown && !_owner.ACOwner.IsPlayer) { if (eht != AttackHitType.HitFly) { eht = AttackHitType.KnockDown; } } else { eht = AttackHitType.None; } } else if (expectHitType == AttackHitType.HitFly) { } else { if (((eht == AttackHitType.None) || _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_RIGIDBODY) && eht == AttackHitType.HurtNormal) || _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_RIGIDBODY2) || (eht < expectHitType && eht != AttackHitType.ParrySuccess && expectHitType != AttackHitType.ForceBack) || (eht == AttackHitType.Dizzy && expectHitType == AttackHitType.Dizzy) || (eht == AttackHitType.KnockDown && expectHitType == AttackHitType.KnockDown) || (eht != AttackHitType.KnockDown && eht != AttackHitType.HitFly && expectHitType == AttackHitType.KnockDown) || _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_DEEP_FREEZE) || (_owner.AIStateAgent.CurrentStateID == AIAgent.STATE.STAND && eht == AttackHitType.HitFly) || _owner.HasActionSwitchFlag(FC_ACTION_SWITCH_FLAG.IN_EOT_GODDOWN)) { eht = AttackHitType.None; } if (eht == AttackHitType.ParrySuccess && (expectHitType == AttackHitType.HitFly || expectHitType == AttackHitType.KnockDown || expectHitType == AttackHitType.Dizzy)) { eht = AttackHitType.None; } } if (eht != AttackHitType.None) { _nextHitType = eht; _attackerType = aut.GetAttackerType(); _effectTime = aif._effectTime; _hitStrength = aut.GetOwner().CharacterStrength; //base value is 100 } if (eht == AttackHitType.BlackHole) { _target = aut.GetOwner(); } return(eht); }
/// <summary> /// 获取攻击单位 /// </summary> /// <param name="position">攻击方的位置</param> /// <param name="attackType">攻击方式</param> /// <param name="attackTaget">攻击目标</param> /// <param name="targetEmbattle"></param> private static CombatGeneral[] GetTargetUnit(int position, AttackUnit attackType, AttackTaget attackTaget, EmbattleQueue targetEmbattle) { IGeneral[] generalList = new IGeneral[0]; List<CombatGeneral> targetGeneralList = new List<CombatGeneral>(); switch (attackType) { case AttackUnit.Single: CombatGeneral cg = null; if (attackTaget == AttackTaget.Self) { cg = (CombatGeneral)targetEmbattle.GetGeneral(position); } else { cg = (CombatGeneral)targetEmbattle.FindGeneral(position); } if (cg != null) { generalList = new IGeneral[] { cg }; } break; case AttackUnit.Horizontal: generalList = targetEmbattle.FindHorizontal(position); break; case AttackUnit.Vertical: generalList = targetEmbattle.FindVertical(position); break; case AttackUnit.All: generalList = targetEmbattle.FindAll(); break; default: break; } foreach (IGeneral general in generalList) { targetGeneralList.Add((CombatGeneral)general); } return targetGeneralList.ToArray(); }
protected override object this[string index] { get { #region switch (index) { case "AbilityID": return AbilityID; case "AbilityName": return AbilityName; case "AttackType": return AttackType; case "AbilityProperty": return AbilityProperty; case "AttackUnit": return AttackUnit; case "AttackTaget": return AttackTaget; case "RatioNum": return RatioNum; case "IsIncrease": return IsIncrease; case "HitPercent": return HitPercent; case "IsCorrect": return IsCorrect; case "IsIncreaseCorrect": return IsIncreaseCorrect; case "AbilityType": return AbilityType; case "BaseEffectNum": return BaseEffectNum; case "IncreaseNum": return IncreaseNum; case "EffectCount": return EffectCount; case "RatioIncreaseNum": return RatioIncreaseNum; case "EffectDesc": return EffectDesc; case "AbilityDesc": return AbilityDesc; case "IsMove": return IsMove; case "EffectID1": return EffectID1; case "EffectID2": return EffectID2; case "Version": return Version; case "AbilityStyle": return AbilityStyle; case "HeadID": return HeadID; case "DemandLv": return DemandLv; case "ChangeAbility": return ChangeAbility; case "AfterAbility": return AfterAbility; case "MaxHeadID": return MaxHeadID; case "Probability": return Probability; case "FntHeadID": return FntHeadID; case "IsActive": return IsActive; case "AbilityQuality": return AbilityQuality; default: throw new ArgumentException(string.Format("AbilityInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "AbilityID": _AbilityID = value.ToInt(); break; case "AbilityName": _AbilityName = value.ToNotNullString(); break; case "AttackType": _AttackType = value.ToEnum<AttackType>(); break; case "AbilityProperty": _AbilityProperty = value.ToEnum<AbilityProperty>(); break; case "AttackUnit": _AttackUnit = value.ToEnum<AttackUnit>(); break; case "AttackTaget": _AttackTaget = value.ToEnum<AttackTaget>(); break; case "RatioNum": _RatioNum = value.ToDecimal(); break; case "IsIncrease": _IsIncrease = value.ToBool(); break; case "HitPercent": _HitPercent = value.ToDecimal(); break; case "IsCorrect": _IsCorrect = value.ToBool(); break; case "IsIncreaseCorrect": _IsIncreaseCorrect = value.ToBool(); break; case "AbilityType": _AbilityType = value.ToNotNullString(); break; case "BaseEffectNum": _BaseEffectNum = value.ToNotNullString(); break; case "IncreaseNum": _IncreaseNum = value.ToNotNullString(); break; case "EffectCount": _EffectCount = value.ToShort(); break; case "RatioIncreaseNum": _RatioIncreaseNum = value.ToDecimal(); break; case "EffectDesc": _EffectDesc = value.ToNotNullString(); break; case "AbilityDesc": _AbilityDesc = value.ToNotNullString(); break; case "IsMove": _IsMove = value.ToBool(); break; case "EffectID1": _EffectID1 = value.ToNotNullString(); break; case "EffectID2": _EffectID2 = value.ToNotNullString(); break; case "Version": _Version = value.ToInt(); break; case "AbilityStyle": _AbilityStyle = value.ToShort(); break; case "HeadID": _HeadID = value.ToNotNullString(); break; case "DemandLv": _DemandLv = value.ToShort(); break; case "ChangeAbility": _ChangeAbility = value.ToEnum<AbilityType>(); break; case "AfterAbility": _AfterAbility = value.ToEnum<AbilityType>(); break; case "MaxHeadID": _MaxHeadID = value.ToNotNullString(); break; case "Probability": _Probability = value.ToDecimal(); break; case "FntHeadID": _FntHeadID = value.ToNotNullString(); break; case "IsActive": _IsActive = value.ToShort(); break; case "AbilityQuality": _AbilityQuality = value.ToInt(); break; default: throw new ArgumentException(string.Format("AbilityInfo index[{0}] isn't exist.", index)); } #endregion } }
public static void HandleHit(ActionController owner, AttackUnit attackUnit, FC_DAMAGE_TYPE damageType, ActionController target) { if (owner.IsAlived) { if (owner.ACGetCurrentAttack() != null) { owner.ACIsHitTarget(target, attackUnit.GetSharpness(), owner.ACGetCurrentAttack()._hitGainEnergy, attackUnit.GetAttackInfo()._isFromSkill); } else { owner.ACIsHitTarget(target, 0, false, attackUnit.GetAttackInfo()._isFromSkill); } } if (attackUnit.GetAttackInfo()._damageType != FC_DAMAGE_TYPE.NONE) { damageType = attackUnit.GetAttackInfo()._damageType; } if (damageType != FC_DAMAGE_TYPE.NONE && !(target.SuperArmorSelf.ActiveArmor() == FCConst.SUPER_ARMOR_LVL2 && target.SuperArmorSelf.DamageAbsorb(FCConst.SUPER_ARMOR_LVL2) > 0.99f)) { //play blood effect Vector3 bloodPos = target.ACGetTransformByName(EnumEquipSlot.belt).position; //play blood on ground with random rotation int rotY = Random.Range(0, 360); Quaternion rot = Quaternion.Euler(0, rotY, 0); Vector3 bloodGroundPos = target.ACGetTransformByName(EnumEquipSlot.foot_point).position; bloodGroundPos.y -= target.SelfMoveAgent.GetFlyHeight(); GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD_GROUND, bloodGroundPos, rot); //play effect by damage type switch (damageType) { case FC_DAMAGE_TYPE.PHYSICAL: { if (target.HasBloodEffect) { //play physical attack effect GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.ATTACK_PHYSICAL , bloodPos); GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD , bloodPos); } } break; case FC_DAMAGE_TYPE.FIRE: { CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.FIRE_ATTACK , target._avatarController, -1); } break; case FC_DAMAGE_TYPE.POISON: { CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_POISON , target._avatarController, -1); } break; case FC_DAMAGE_TYPE.ICE: { CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_ICE , target._avatarController, -1); } break; case FC_DAMAGE_TYPE.THUNDER: { CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_THUNDER , target._avatarController, -1); } break; default: { Assertion.Check(false, "now we do not support this type damage"); } break; } } }