public override DamageResult Apply(DamageInfo dinfo, Thing victim) { var damageResult = new DamageResult(); if (victim.def.category != ThingCategory.Pawn || (victim as Pawn)?.RaceProps.FleshType.defName == "Insectoid" || ((Pawn)victim).RaceProps.IsMechanoid || !victim.def.useHitPoints || !dinfo.Def.harmsHealth) { return(damageResult); } var num = dinfo.Amount; damageResult.totalDamageDealt = Mathf.Min(victim.HitPoints, GenMath.RoundRandom(num)); victim.HitPoints -= Mathf.RoundToInt(damageResult.totalDamageDealt); if (victim.HitPoints > 0) { return(damageResult); } victim.HitPoints = 0; victim.Kill(dinfo); return(damageResult); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult damageResult = base.Apply(dinfo, victim); damageResult.stunned = true; return(damageResult); }
protected override void trigger() { lazer.enabled = true; lazer.SetPosition(0, transform.position); shootRay.origin = barrelEnd.transform.position; shootRay.direction = owner.transform.forward; lazer.SetPosition(1, shootRay.origin + shootRay.direction * weapon.range); if (Physics.Raycast(shootRay, out shootHit, weapon.range)) { GameObject target = shootHit.transform.gameObject; lazer.SetPosition(1, shootHit.point); if (target.CompareTag(Tags.Player)) { DamageResult result = target.GetComponent <PlayerController>().receiveDamage(weapon.damage, false); if (weapon.hasEffect) { target.GetComponent <PlayerController>().applyEffect(weapon.effect); } if (result == DamageResult.MORTAL_HIT) { owner.player.applyPoints(10); } } else if (target.CompareTag(Tags.Cover)) { target.GetComponent <BaseDestructable>().takeDamage(weapon.damage); } } playTriggerSound(); ammo--; Invoke(Utils.getActionName(disableEffects), 0.05f); }
private void DoResult(DamageResult Res) { if (Res.mSound != null) { Vector3 position = Camera.main.transform.position + (Res.mAffectedObject.transform.position - Camera.main.transform.position).normalized * 5f; AudioSource.PlayClipAtPoint(Res.mSound, position, GameData.mGameSettings.mSoundVolume); } switch (Res.mEffect) { case ObjectEffects.DisableObject: Res.mAffectedObject.SetActiveRecursively(state: false); break; case ObjectEffects.ShieldWallEffect: { ShieldWall shieldWall = null; if ((bool)(shieldWall = (Res.mAffectedObject.GetComponent(typeof(ShieldWall)) as ShieldWall))) { shieldWall.KillTrigger(); } break; } case ObjectEffects.SpawnObject: if (Res.mAffectedObject != null) { UnityEngine.Object.Instantiate(Res.mAffectedObject, base.transform.position + Res.mOffsetPosition, Quaternion.identity); } break; } }
private DamageResult ResolveWeaponAttack(WeaponSystem weapon, int range, ScreenRating screenRating, int evasion = 0, int otherDRM = 0, Constants.DamageType damageTypeModifier = Constants.DamageType.None, AttackSpecialProperties attackPropertiesModifier = AttackSpecialProperties.None) { AttackSpecialProperties effectiveAttackProperties = weapon.FinalizeAttackProperties(attackPropertiesModifier); // Weapons with a hight TrackRating can ignore Evasion, offsetting up to the full Evasion DRM int totalDRM = weapon.FinalizeEvasionDRM(evasion) + otherDRM; // Weapons can ignore certain kinds of shields but not others int totalScreenRating = weapon.FinalizeScreenValue(screenRating, effectiveAttackProperties); Constants.DamageType effectiveDamageType = weapon.FinalizeDamageType(weapon.GetDamageType(), damageTypeModifier, effectiveAttackProperties.HasFlag(AttackSpecialProperties.Overrides_Weapon_DamageType)); // Roll dice here this.Logger.LogInformation($"Attack roll! {weapon.SystemName} -- range {range} | screen {screenRating.ToString()} | net DRM {totalDRM} | {effectiveDamageType.ToString()}-type damage | rating {weapon.Rating}"); /* "Basic" weapon behavior is to shoot like a non-penetrating beam: * 1D per Rating, diminishing with range * 1 damage on a 4 unless screened * 1 damage on a 5, always * 2 damage on a 6, unless double-screened -- then 1 */ DamageResult damageMatrix = FullThrustDieRolls.RollFTDamage(this.DiceUtility, weapon.GetAttackDice(), totalDRM, totalScreenRating, effectiveDamageType.HasFlag(Constants.DamageType.Penetrating)); return(damageMatrix); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult result = new DamageResult(); Pawn hitPawn = victim as Pawn; if (hitPawn == null) { return(result); } var pawnAnethesized = hitPawn?.health?.hediffSet?.GetFirstHediffOfDef(HediffDefTranquilizer.Tranquilizer); var addedSeverity = OneHitMechanics ? 1f : Rand.Range(0.9f, 1.5f) / (hitPawn.BodySize); if (pawnAnethesized != null) { pawnAnethesized.Severity += addedSeverity; } else { Hediff hediff = HediffMaker.MakeHediff(HediffDefTranquilizer.Tranquilizer, hitPawn, null); hediff.Severity = addedSeverity; hitPawn.health.AddHediff(hediff, null, null); } return(result); }
public override DamageResult Apply(DamageInfo dinfo, Thing thing) { var result = new DamageResult { totalDamageDealt = 0f }; if (thing is PawnGhost) { Messages.Message("PJ_ForceGhostResisted".Translate(), MessageTypeDefOf.NegativeEvent); return(result); } if (thing is not Pawn pawn) { return(result); } if (dinfo.Instigator == null) { return(result); } if (dinfo.Instigator is not Pawn caster) { return(result); } var victimForce = pawn.GetComp <CompForceUser>(); var maxInjuries = 2; var maxHeals = 0; var maxPoolDamage = 30; if (victimForce is { IsForceUser : true })
public DamageResult CastDamage(MotionBase monster) { DamageResult result = new DamageResult(); result._TargetMotion = this; result._BeforeHP = _HP; int damage = 0; if (monster._MonsterRecord != null) { var elementRelation = BattleField.GetRoleDefRelation(monster._MonsterRecord.ElementType); float relation = BattleField.GetRelationRate(elementRelation); damage = (int)(monster._Attack * relation); result._DamageType = DAMAGE_TYPE.Normal; if (relation > 1) { result._DamageType = DAMAGE_TYPE.Double; } else if (relation < 1) { result._DamageType = DAMAGE_TYPE.Half; } } result.DamageValue = damage; _HP -= damage; result._AfterHP = _HP; return(result); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { Pawn pawn = victim as Pawn; if (pawn != null && pawn.Faction == Faction.OfPlayer) { Find.TickManager.slower.SignalForceNormalSpeedShort(); } Map map = victim.Map; DamageResult damageResult = base.Apply(dinfo, victim); if (!damageResult.deflected && !dinfo.InstantPermanentInjury) { victim.TryAttachFire(Rand.Range(0.15f, 0.25f)); } if (victim.Destroyed && map != null && pawn == null) { foreach (IntVec3 item in victim.OccupiedRect()) { FilthMaker.TryMakeFilth(item, map, ThingDefOf.Filth_Ash); } Plant plant = victim as Plant; if (plant != null && victim.def.plant.IsTree && plant.LifeStage != 0 && victim.def != ThingDefOf.BurnedTree) { ((DeadPlant)GenSpawn.Spawn(ThingDefOf.BurnedTree, victim.Position, map)).Growth = plant.Growth; } } return(damageResult); }
public void TestConditionalGrapple() { Monster vineBlight = MonsterBuilder.BuildVineBlight(); Character barbarian1 = CharacterBuilder.BuildTestBarbarian(); Character barbarian2 = CharacterBuilder.BuildTestBarbarian(); Character elf = CharacterBuilder.BuildTestElf(); Character druid = CharacterBuilder.BuildTestDruid(); elf.creatureSize = CreatureSize.Small; barbarian1.creatureSize = CreatureSize.Huge; Assert.IsFalse(barbarian1.HasCondition(Conditions.Grappled)); Assert.IsFalse(elf.HasCondition(Conditions.Grappled)); Assert.IsFalse(druid.HasCondition(Conditions.Grappled)); int attackRoll = vineBlight.GetAttackRoll(12, AttackNames.Constrict); Assert.AreEqual(16, attackRoll); barbarian1.baseArmorClass = 13; barbarian2.baseArmorClass = 17; DamageResult elfDamage = vineBlight.GetDamageFromAttack(elf, AttackNames.Constrict, 10, attackRoll); DamageResult barbarian1Damage = vineBlight.GetDamageFromAttack(barbarian1, AttackNames.Constrict, 10, attackRoll); DamageResult barbarian2Damage = vineBlight.GetDamageFromAttack(barbarian2, AttackNames.Constrict, 10, attackRoll); Assert.IsNull(barbarian2Damage); // Barbarian 2's AC is 17, which should result in a miss - no damage. DamageResult druidDamage = vineBlight.GetDamageFromAttack(druid, AttackNames.Constrict, 12, attackRoll); Assert.IsFalse(barbarian1Damage.HasCondition(Conditions.Grappled)); // barbarian 1 is huge => no damage. Assert.IsTrue(elfDamage.HasCondition(Conditions.Grappled)); Assert.IsFalse(druidDamage.HasCondition(Conditions.Grappled)); // druid saving throw avoids the grapple. Assert.AreEqual(-9, elfDamage.hitPointChange); Assert.AreEqual(-9, barbarian1Damage.hitPointChange); Assert.AreEqual(-9, druidDamage.hitPointChange); Assert.AreEqual(DamageType.Bludgeoning | DamageType.Condition, elfDamage.damageTypes); Assert.AreEqual(DamageType.Bludgeoning, barbarian1Damage.damageTypes); Assert.AreEqual(DamageType.Bludgeoning, druidDamage.damageTypes); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { var damageResult = new DamageResult(); if (victim.def.category != ThingCategory.Pawn || !((Pawn)victim).health.capacities.CapableOf(PawnCapacityDefOf.Breathing) || !victim.def.useHitPoints || !dinfo.Def.harmsHealth) { return(damageResult); } var num = dinfo.Amount; if (num > 0f) { var sensitivity = victim.GetStatValue(StatDefOf.ToxicSensitivity); num = num * sensitivity * toxicRatio; } damageResult.totalDamageDealt = Mathf.Min(victim.HitPoints, GenMath.RoundRandom(num)); victim.HitPoints -= Mathf.RoundToInt(damageResult.totalDamageDealt); if (victim.HitPoints > 0) { return(damageResult); } victim.HitPoints = 0; victim.Kill(dinfo); return(damageResult); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { var damageResult = new DamageResult(); if (victim.def.category != ThingCategory.Plant || victim.def.plant.purpose != PlantPurpose.Misc || victim.def.plant.IsTree || !victim.def.useHitPoints || !dinfo.Def.harmsHealth) { return(damageResult); } var num = dinfo.Amount; num *= dinfo.Def.plantDamageFactor; damageResult.totalDamageDealt = Mathf.Min(victim.HitPoints, GenMath.RoundRandom(num)); victim.HitPoints -= Mathf.RoundToInt(damageResult.totalDamageDealt); if (victim.HitPoints > 0) { return(damageResult); } victim.HitPoints = 0; victim.Kill(dinfo); return(damageResult); }
public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged) { if (p_attackList == null) { return; } Single num = m_staticData.GetValues(m_level)[0] * 0.01f; for (Int32 i = 0; i < p_attackList.Count; i++) { AttackResult attackResult = p_attackList[i]; for (Int32 j = 0; j < attackResult.DamageResults.Count; j++) { DamageResult value = attackResult.DamageResults[j]; value.EffectiveValue = (Int32)(value.EffectiveValue * m_percentValue + 0.5f); attackResult.DamageResults[j] = value; } m_passedStrikes++; if (attackResult.Result != EResultType.BLOCK && attackResult.Result != EResultType.EVADE) { if (m_percentValue == 1f && p_monster.CombatHandler.MeleeStrikes > m_passedStrikes) { AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this); p_monster.AbilityHandler.AddEntry(EExecutionPhase.AFTER_MONSTER_ATTACK, p_args); } m_percentValue += num; } } }
private void attackCheck() { if (_agent == null || _attackTimer > 0) { return; } if (_view != null) { _view.DebugDraw(position, 0.75f); } Collider[] targets = Physics.OverlapSphere(position, 0.75f, _playerLayer);//, _def.targetMask); if (targets != null) { for (int i = 0; i < targets.Length; ++i) { Transform targetXform = targets[i].transform; IDamageable target = targetXform.GetComponent <IDamageable>(); if (target == null) { continue; } Vector3 direction = (targetXform.position - _agent.transform.position).normalized; Vector3 force = direction * 10.0f; DamageResult damageResult = target.TakeDamage(this, _def.attack.damage); _dispatcher.DispatchEvent(GameplayEventType.DAMAGE_TAKEN, false, damageResult); } } _attackTimer = _def.attack.refreshDuration; }
private DamageWorker.DamageResult ApplyToPawn(DamageInfo dinfo, Pawn pawn) { DamageResult result = DamageResult.MakeNew(); if (dinfo.Amount <= 0) { return(result); } if (!DebugSettings.enablePlayerDamage && pawn.Faction == Faction.OfPlayer) { return(result); } Map mapHeld = pawn.MapHeld; bool spawnedOrAnyParentSpawned = pawn.SpawnedOrAnyParentSpawned; BodyPartRecord consciousnessSource = pawn.def.race.body.AllParts.FirstOrDefault((BodyPartRecord x) => x.def == BodyPartDefOf.Brain || x.def.tags.Contains("ConsciousnessSource")); if (consciousnessSource != null) { Hediff pressure = pawn.health.hediffSet.GetFirstHediffOfDef(MonsterDefOf.ROM_IntracranialPressure); if (pressure == null) { pressure = HediffMaker.MakeHediff(MonsterDefOf.ROM_IntracranialPressure, pawn, consciousnessSource); pressure.Severity = 0.01f; pawn.health.AddHediff(pressure, consciousnessSource, null); } float resultDMG = pressure.Severity + Rand.Range(0.1f, 0.3f); pressure.Severity = Mathf.Clamp(resultDMG, 0.0f, 1.0f); result.totalDamageDealt += resultDMG; return(result); } return(result); }
public virtual DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult damageResult = new DamageResult(); if (victim.SpawnedOrAnyParentSpawned) { ImpactSoundUtility.PlayImpactSound(victim, dinfo.Def.impactSoundType, victim.MapHeld); } if (victim.def.useHitPoints && dinfo.Def.harmsHealth) { float num = dinfo.Amount; if (victim.def.category == ThingCategory.Building) { num *= dinfo.Def.buildingDamageFactor; } if (victim.def.category == ThingCategory.Plant) { num *= dinfo.Def.plantDamageFactor; } damageResult.totalDamageDealt = (float)Mathf.Min(victim.HitPoints, GenMath.RoundRandom(num)); victim.HitPoints -= Mathf.RoundToInt(damageResult.totalDamageDealt); if (victim.HitPoints <= 0) { victim.HitPoints = 0; victim.Kill(dinfo); } } return(damageResult); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { var damageResult = new DamageResult(); if (victim.def.category != ThingCategory.Filth || victim.def.defName == "Filth_USGlowFoam" || victim.def.defName == "Filth_USGlowStick" || !victim.def.useHitPoints || !dinfo.Def.harmsHealth) { return(damageResult); } var num = dinfo.Amount; num *= dinfo.Def.plantDamageFactor; damageResult.totalDamageDealt = Mathf.Min(victim.HitPoints, GenMath.RoundRandom(num)); victim.HitPoints -= Mathf.RoundToInt(damageResult.totalDamageDealt); if (victim.HitPoints > 0) { return(damageResult); } victim.HitPoints = 0; victim.Kill(dinfo); return(damageResult); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult result = DamageResult.MakeNew(); result.totalDamageDealt = 0f; if (victim is ProjectJedi.PawnGhost) { Messages.Message("PJ_ForceGhostResisted".Translate(), MessageTypeDefOf.NegativeEvent); return(result); } int amount = dinfo.Amount; caster = dinfo.Instigator as Pawn; switch (amount) { case 1: ApprenticeEffect(victim); break; case 2: AdeptEffect(victim); break; case 3: MasterEffect(victim); break; default: Log.Error(this.def.label + " only works with damages 1, 2, or 3"); break; } return(result); }
public static int applyDamage(ILuaState luaState) { if (luaState.IsTable(-1)) { DamageResult dmgRes = new DamageResult(); // 攻击者 luaState.GetField(-1, "attacker"); dmgRes.attacker = (Unit)luaState.ToUserData(-1); luaState.Pop(1); // 受害者 luaState.GetField(-1, "victim"); dmgRes.victim = (Unit)luaState.ToUserData(-1); luaState.Pop(1); // 伤害 luaState.GetField(-1, "physicalDamage"); dmgRes.physicalDamage = luaState.ToInteger(-1); luaState.Pop(1); luaState.GetField(-1, "spellDamage"); dmgRes.spellDamage = luaState.ToInteger(-1); luaState.Pop(1); luaState.GetField(-1, "hpRemoval"); dmgRes.hpRemoval = luaState.ToInteger(-1); luaState.Pop(1); // 伤害原因 luaState.GetField(-1, "damageReason"); dmgRes.damageReason = (BattleConsts.DamageReason)luaState.ToInteger(-1); luaState.Pop(1); ProcessManager.getInstance().addResult(dmgRes); } return 0; }
public override void ShowDamageBubble(DamageResult dr) { if (dr.bubbleType == Bubble.BubbleType.eBT_Miss) //屏蔽怪物的未命中aa { return; } if (dr.bubbleType == Bubble.BubbleType.eBT_Miss) { Bubble.MissBubble(Vector3.zero, true); } else if (dr.bubbleType == Bubble.BubbleType.eBT_Dodge) { Bubble.Dodge(transform.position + new Vector3(0.0f, 2.0f, 0.0f), true); } else if (dr.bubbleType == Bubble.BubbleType.eBT_SelfHurt) { Bubble.SelfHurt(-dr.damage, transform.position + new Vector3(0.0f, 2.0f, 0.0f), dr.bubbleType); } else { Bubble.OtherHurt(-dr.damage, transform.position, dr.bubbleType); } }
public DamageResult MonsterRoundAct() { DamageResult dmgResult = new DamageResult(); dmgResult._TargetMotion = this; dmgResult._BeforeHP = BattleField.Instance._RoleMotion._HP; foreach (var skill in _Skills) { if (skill.IsCanUseSkill()) { skill.UseSkill(BattleField.Instance._RoleMotion, ref dmgResult); dmgResult._UseSkill = skill; dmgResult._AfterHP = BattleField.Instance._RoleMotion._HP; break; } } if (dmgResult._UseSkill == null) { return(null); } return(dmgResult); }
private void onDamageTaken(GeneralEvent e) { DamageResult data = e.data as DamageResult; if (data != null) { } }
public DamageResult TakeDamage(object attacker, float damage) { DamageResult result = new DamageResult(); result.attacker = attacker; result.victim = this; return(result); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult result; if (!(victim is Fire fire) || fire.Destroyed) { result = new DamageResult(); }
// 浼ゅ?鍥炶皟(缁ф壙鑷猻dActorInterface)aa public override void OnHurt(DamageResult dr) { if (mAutoFight != null) { mAutoFight.OnHurt(dr.attracker); } base.OnHurt(dr); }
private void ApplySmallPawnDamagePropagation(DamageInfo dinfo, Pawn pawn, DamageResult result) { if (dinfo.AllowDamagePropagation && result.LastHitPart != null && dinfo.Def.harmsHealth && result.LastHitPart != pawn.RaceProps.body.corePart && result.LastHitPart.parent != null && pawn.health.hediffSet.GetPartHealth(result.LastHitPart.parent) > 0f && result.LastHitPart.parent.coverageAbs > 0f && dinfo.Amount >= 10f && pawn.HealthScale <= 0.5001f) { DamageInfo dinfo2 = dinfo; dinfo2.SetHitPart(result.LastHitPart.parent); ApplyDamageToPart(dinfo2, pawn, result); } }
public override void UseSkill(MotionBase targetMotion, ref DamageResult damageResult) { base.UseSkill(targetMotion, ref damageResult); int damage = _MotionBase._Attack; targetMotion.CastDamage(_MotionBase); damageResult.DamageValue = damage; }
static internal AttackResult DeliverAttack(AttackDelivery attackMessage) { // Check for valid message if (attackMessage.DamageDice == null || attackMessage.Target == null || attackMessage.Attacker == null) { throw new ArgumentNullException("AttackDelivery message missing required information"); } ICombatant target = attackMessage.Target; DefenseDelivery defense = target.Defend(); // Compute attack result data // AC = 10 + armor bonus + shield bonus + Dexterity modifier + size modifier // http://www.dandwiki.com/wiki/SRD:Armor_Class int AC = 10 + defense.ArmorBonus + defense.ShieldBonus + defense.DexterityModifier + defense.SizeModifier; AttackResult attackResult = TryToHit(AC, attackMessage.ToHitModifier); DamageResult damageResult; if (attackResult.Hit || attackResult.Critical) { damageResult = RollDamage(attackMessage.DamageDice, attackMessage.DamageModifiers, attackResult.Critical); } else { damageResult = new DamageResult(); damageResult.DamageDealt = new KeyValuePair <DamageType, int> [0]; } damageResult.AttackResult = attackResult; damageResult.Attacker = attackMessage.Attacker; // Determine if blow was strong enough to knock target unconcious (for now, more than half their max HP) if (attackMessage.CombatType == CombatType.Melee) { foreach (var damagePair in damageResult.DamageDealt) { if (damagePair.Key == DamageType.Bludgeoning && damagePair.Value > target.Max_HP / 2) { // For now, you get a 25% chance of being knocked out if damage exceeds half your max. // TODO: Research better calculation for KO savings throw. damageResult.KnockedUnconcious = (Utility.Rand.Next(4) == 0); break; } } } target.TakeDamage(damageResult); return(attackResult); }
public override DamageResult Apply(DamageInfo dinfo, Thing victim) { DamageResult damageResult = base.Apply(dinfo, victim); if (!damageResult.deflected && !dinfo.InstantPermanentInjury && Rand.Chance(FireUtility.ChanceToAttachFireFromEvent(victim) * 0.25f)) { victim.TryAttachFire(Rand.Range(0.15f, 0.25f)); } return(damageResult); }
public void execute() { // 能否反击的判断加入到单位的hurt中 DamageResult dmgRes = new DamageResult(); dmgRes.attacker = this.defender; dmgRes.victim = this.attacker; dmgRes.damageReason = BattleConsts.DamageReason.CounterAttack; dmgRes.physicalDamage = this.defender.UnitAttribute.attack; ProcessManager.getInstance().addResult(dmgRes); }
public static DamageResult MakeNew() { DamageResult result = default(DamageResult); result.wounded = false; result.headshot = false; result.deflected = false; result.totalDamageDealt = 0f; return(result); }
public static object HandleDamageAgainstStructure(User attacker, BaseEntity entity, HitInfo hit) { Area area = Instance.Areas.GetByEntityPosition(entity); if (area == null) { Instance.PrintWarning("An entity was damaged in an unknown area. This shouldn't happen."); return(null); } DamageResult result = DetermineDamageResult(attacker, area, entity); if (EnableTestMode) { Instance.Log("Damage from a player to structure with prefab {0}: {1}", entity.ShortPrefabName, result.ToString()); } if (result == DamageResult.NotProtected || result == DamageResult.Friendly) { return(null); } if (result == DamageResult.Prevent) { return(false); } float reduction = area.GetDefensiveBonus(); if (reduction >= 1) { return(false); } if (reduction > 0) { hit.damageTypes.ScaleAll(reduction); } if (Instance.Options.Zones.Enabled) { BuildingPrivlidge cupboard = entity.GetBuildingPrivilege(); if (cupboard != null && IsRaidTriggeringEntity(entity)) { float remainingHealth = entity.Health() - hit.damageTypes.Total(); if (remainingHealth < 1) { Instance.Zones.CreateForRaid(cupboard); } } } return(null); }
public override void onStateEnter() { Debug.Log("Enter Attack State!"); BattleInfo info = BattleGlobal.Core.battleInfo; this._attacker = info.attacker; this._defender = info.defender; this._attacker.doAttack(); // 造成伤害结果 DamageResult damageResult = new DamageResult(); damageResult.attacker = this._attacker; damageResult.victim = this._defender; damageResult.damageReason = BattleConsts.DamageReason.Attack; damageResult.physicalDamage = this._attacker.UnitAttribute.attack; ProcessManager.getInstance().addResult(damageResult); ProcessManager.getInstance().startProcess(); }
protected override void OnDamaged(DamageResult damage) { //StartCoroutine("AfterDamaged"); Debug.Log("Remain HP = " + AStatus.Hp); }
private void onStateEnter(int stateId) { switch (stateId) { case STATE_CHECK_COUNTER_ATTACK: this.checkCounterAttack(); break; case STATE_COUNTER_ATTACK: // 造成伤害结果 DamageResult damageResult = new DamageResult(); damageResult.attacker = this._defender; damageResult.victim = this._attacker; damageResult.damageReason = BattleConsts.DamageReason.CounterAttack; damageResult.physicalDamage = this._defender.UnitAttribute.attack; ProcessManager.getInstance().addResult(damageResult); ProcessManager.getInstance().startProcess(); this._nextState = STATE_WAITING_TIMING_PROCESSING; break; } }