public void Init(FCObject owner) { _owner = owner as AIAgent; _currentHitType = AttackHitType.None; _attackerType = FCWeapon.WEAPON_HIT_TYPE.NONE; _hurtInfoForClient = Quaternion.identity; _hurtInfoForClient2 = Quaternion.identity; }
public void ClearHurtState() { _currentHitType = AttackHitType.None; _nextHitType = AttackHitType.None; }
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); }
//if result >0 ,means super armor is destroy, will do damage to owner // public int TryToHit(int forceValue, float damage, AttackHitType eht, ref int damageResult) { int armorBroken = -1; bool ret = true; if (_owner.CurrentAttack != null && _owner.CurrentAttack._needIgnoreSuperArmor) { ret = false; } if (_armorValues[FCConst.SUPER_ARMOR_LVL2] > 0 && ret) { damageResult = (int)(damage * _absorbValues[FCConst.SUPER_ARMOR_LVL2]); _armorValues[FCConst.SUPER_ARMOR_LVL2] -= forceValue; _armorValues[FCConst.SUPER_ARMOR_LVL2] -= damageResult; //thats real damage damageResult = (int)damage - damageResult; forceValue = 0; if (_armorValues[FCConst.SUPER_ARMOR_LVL2] <= 0) { // super armor is broken // try to use next level super armor to block attack armorBroken = FCConst.SUPER_ARMOR_LVL2; } else { //return armorBroken; } } // if super armor is broken, try to destroy normal armor if (_armorValues[FCConst.SUPER_ARMOR_LVL1] > 0) { int dr1 = (int)(damageResult * _absorbValues[FCConst.SUPER_ARMOR_LVL1]); _armorValues[FCConst.SUPER_ARMOR_LVL1] -= forceValue; if (forceValue <= 0) { _armorValues[FCConst.SUPER_ARMOR_LVL1] -= damage; } else { _armorValues[FCConst.SUPER_ARMOR_LVL1] -= dr1; } //thats real damage damageResult = (int)damageResult - dr1; if (_armorValues[FCConst.SUPER_ARMOR_LVL1] <= 0) { // super armor is broken forceValue = 0; armorBroken = FCConst.SUPER_ARMOR_LVL1; if (!_owner.HasState(AIAgent.STATE.ARMOR1_BROKEN)) { Revive(FCConst.SUPER_ARMOR_LVL1); } } return(armorBroken); } if (_armorValues[FCConst.SUPER_ARMOR_LVL1] <= 0 && _armorValues[FCConst.SUPER_ARMOR_LVL2] <= 0) { _armorValues[FCConst.SUPER_ARMOR_LVL0] -= forceValue; #if xingtianbo if (((eht == AttackHitType.Normal || eht >= AttackHitType.NORMAL_HURT) && _armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) || (eht > AttackHitType.Normal && eht < AttackHitType.NORMAL_HURT) || (eht > AttackHitType.BLEND_HURT)) { //normal armor is broken armorBroken = FCConst.SUPER_ARMOR_LVL0; } #endif if ((eht == AttackHitType.None && _armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) || (eht > AttackHitType.None)) { //normal armor is broken armorBroken = FCConst.SUPER_ARMOR_LVL0; } if (_armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) { Revive(FCConst.SUPER_ARMOR_LVL0); } } if (damage > 0 && damageResult <= 1) { damageResult = 1; } return(armorBroken); }