private void ExecuteOutputPower(Ability parentAbility, ExecuteInfo executeInfo) { if (parentAbility == executeInfo.Ability) { int finalOutputPower = OutputPower; switch (executeInfo.MechaComponentInfo.CurrentQualityUpgradeData) { case QualityUpgradeData_Engine pud_Engine: { finalOutputPower = pud_Engine.OutputPower; break; } } executeInfo.MechaComponentInfo.AccumulatedPowerInsideThisFrame = finalOutputPower; List <GridPos> allSlotLocalPositions_Local = executeInfo.MechaComponentInfo.OriginalAllSlotLocalPositions; List <GridPos> allSlotLocalPositions_Matrix = GridPos.TransformOccupiedPositions(executeInfo.MechaComponentInfo.InventoryItem.GridPos_Matrix, allSlotLocalPositions_Local.Clone()); foreach (GridPos gp in allSlotLocalPositions_Matrix) { executeInfo.MechaInfo.ProvidePower(gp, finalOutputPower); } } }
private void ExecuteProjectileDamage(Ability parentAbility, ExecuteInfo executeInfo, ProjectileInfo.FlyRealtimeData flyRealTimeData) { if (parentAbility == executeInfo.Ability) { int finalDamage = Damage; switch (executeInfo.MechaComponentInfo.CurrentPowerUpgradeData) { case PowerUpgradeData_Gun pud_Gun: { finalDamage += Mathf.FloorToInt(pud_Gun.DamageIncreasePercent / 100f * Damage); break; } } switch (Target) { case SingleActionTarget singleTarget: { switch (singleTarget.Target) { case ENUM_SingleTarget.ATTACKER: { break; } case ENUM_SingleTarget.CASTER: { if (flyRealTimeData.HitMechaComponentInfo != null) { if (flyRealTimeData.HitMechaComponentInfo == executeInfo.MechaComponentInfo && flyRealTimeData.HitMechaComponentInfo.CheckAlive()) { Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to <color=\"#FF74FF\">{singleTarget.Target.ToString()}</color> {flyRealTimeData.HitMechaComponentInfo.LogIdentityName}"); flyRealTimeData.HitMechaComponentInfo.Damage(executeInfo.MechaComponentInfo, finalDamage); } } break; } case ENUM_SingleTarget.POINT: { break; } case ENUM_SingleTarget.TARGET: { break; } case ENUM_SingleTarget.UNIT: { if (flyRealTimeData.HitMechaComponentInfo != null && flyRealTimeData.HitMechaComponentInfo.CheckAlive()) { bool canDamage = false; switch (singleTarget.Team) { case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_BOTH: { canDamage = true; break; } case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_ENEMY: { canDamage = flyRealTimeData.HitMechaComponentInfo.MechaInfo.IsOpponent(executeInfo.MechaInfo); break; } case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_FRIENDLY: { canDamage = flyRealTimeData.HitMechaComponentInfo.MechaInfo.IsFriend(executeInfo.MechaInfo); break; } case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_NONE: { canDamage = false; break; } } if (canDamage) { Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to <color=\"#FF74FF\">{singleTarget.Target.ToString()}</color> {flyRealTimeData.HitMechaComponentInfo.LogIdentityName}"); flyRealTimeData.HitMechaComponentInfo.Damage(executeInfo.MechaComponentInfo, finalDamage); } } break; } } break; } case MultipleActionTarget multipleTarget: { int finalRadius = multipleTarget.Radius; int finalMaxTargets = multipleTarget.MaxTargets; switch (executeInfo.MechaComponentInfo.CurrentPowerUpgradeData) { case PowerUpgradeData_Gun pud_Gun: { finalRadius += Mathf.FloorToInt(pud_Gun.DamageRangeIncreasePercent / 100f * multipleTarget.Radius); finalMaxTargets = pud_Gun.DamageMaxTargetsOverride; break; } } switch (multipleTarget.Center) { case ENUM_MultipleTargetCenter.PROJECTILE: { List <MechaComponentInfo> hitMCIs = BattleManager.Instance.SearchRangeHandler(flyRealTimeData.Position, finalRadius, executeInfo.MechaInfo.MechaCamp, multipleTarget.Team, finalMaxTargets, multipleTarget.Random); foreach (MechaComponentInfo mci in hitMCIs) { Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to {mci.LogIdentityName}"); mci.Damage(executeInfo.MechaComponentInfo, finalDamage); } break; } } break; } } } }
public void Execute(ExecuteInfo executeInfo) { ProjectileInfo pi = new ProjectileInfo(this, executeInfo, null, Vector3.zero); ProjectileManager.Instance.EmitProjectileHandler(pi); }