FIX uses unit repair values with RepairsUnits trait, Buildings use right repair values, nuke unused GeneralInfo
This commit is contained in:
@@ -1,110 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
*
|
||||
* OpenRA is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OpenRA is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
public class GeneralInfo
|
||||
{
|
||||
/* Special Weapons */
|
||||
public readonly float GapRegenInterval =0;
|
||||
public readonly int BadgerBombCount = 1;
|
||||
|
||||
/* Chrono Side Effects */
|
||||
public readonly float QuakeChance = 0;
|
||||
public readonly float QuakeDamage = 0; /* percent */
|
||||
public readonly float VortexChance = 0;
|
||||
public readonly int VortexDamage = 0;
|
||||
public readonly int VortexRange = 0;
|
||||
public readonly int VortexSpeed = 0;
|
||||
|
||||
/* Repair & Refit */
|
||||
public readonly float RefundPercent = 0;
|
||||
public readonly float ReloadRate = 0;
|
||||
public readonly float RepairPercent = 0;
|
||||
public readonly float RepairRate = 0;
|
||||
public readonly int RepairStep = 0;
|
||||
public readonly float URepairPercent = 0;
|
||||
public readonly int URepairStep = 0;
|
||||
|
||||
/* Combat & Damage */
|
||||
public readonly float TurboBoost = 1.5f;
|
||||
public readonly float BallisticScatter = 0;
|
||||
public readonly float C4Delay = 0;
|
||||
public readonly float ExpSpread = 0;
|
||||
public readonly int FireSupress = 0;
|
||||
public readonly float HomingScatter = 0;
|
||||
public readonly int MaxDamage = 0;
|
||||
public readonly int MinDamage = 0;
|
||||
public readonly bool OreExplosive = false;
|
||||
public readonly bool PlayerAutoCrush = false;
|
||||
public readonly bool PlayerReturnFire = false;
|
||||
public readonly bool PlayerScatter = false;
|
||||
public readonly bool TreeTargeting = false;
|
||||
public readonly int Incoming = 0;
|
||||
|
||||
/* Income & Production */
|
||||
public readonly float BuildSpeed = 0;
|
||||
public readonly float BuildupTime = 0;
|
||||
public readonly float OreTruckRate = 0;
|
||||
public readonly bool SeparateAircraft = true;
|
||||
public readonly float SurvivorRate = 0;
|
||||
|
||||
/* Audo/Visual Map Controls */
|
||||
public readonly bool AllyReveal = true;
|
||||
public readonly float ConditionRed = 0;
|
||||
public readonly float ConditionYellow = 0;
|
||||
public readonly int DropZoneRadius = 0;
|
||||
public readonly bool EnemyHealth = true;
|
||||
public readonly int Gravity = 0;
|
||||
public readonly float IdleActionFrequency = 0;
|
||||
public readonly float MessageDelay = 0;
|
||||
public readonly float MovieTime = 0;
|
||||
public readonly bool NamedCivilians = false;
|
||||
public readonly float SavourDelay = 0;
|
||||
public readonly int ShroudRate = 0;
|
||||
public readonly int SpeakDelay = 0;
|
||||
public readonly int TimerWarning = 0;
|
||||
public readonly bool FlashLowPower = false;
|
||||
|
||||
/* Computer & Movement Controls */
|
||||
public readonly bool CurleyShuffle = false;
|
||||
public readonly float BaseBias = 0;
|
||||
public readonly float BaseDefenseDelay = 0;
|
||||
public readonly float CloseEnough = 0;
|
||||
public readonly int DamageDelay = 0;
|
||||
public readonly int GameSpeeBias = 0;
|
||||
public readonly int LZScanRadius = 0;
|
||||
public readonly bool MineAware = false;
|
||||
public readonly float Stray = 0;
|
||||
public readonly float SubmergeDelay = 0;
|
||||
public readonly float SuspendDelay = 0;
|
||||
public readonly int SuspendPriority = 0;
|
||||
public readonly float TeamDelay = 0;
|
||||
|
||||
/* Misc */
|
||||
[Obsolete]
|
||||
public readonly bool FineDiffControl = false;
|
||||
|
||||
/* OpenRA-specific */
|
||||
public readonly int LowPowerSlowdown = 3; /* build time multiplier */
|
||||
}
|
||||
}
|
||||
@@ -302,6 +302,7 @@
|
||||
<Compile Include="Traits\CrateAction.cs" />
|
||||
<Compile Include="Effects\CrateEffect.cs" />
|
||||
<Compile Include="Traits\World\GlobalDefaults.cs" />
|
||||
<Compile Include="Traits\RepairsUnits.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -36,11 +36,14 @@ namespace OpenRA.Traits.Activities
|
||||
if (isCanceled) return NextActivity;
|
||||
if (remainingTicks == 0)
|
||||
{
|
||||
var hostBuilding = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
.FirstOrDefault(a => a.traits.Contains<RenderBuilding>());
|
||||
|
||||
var unitCost = self.Info.Traits.Get<BuildableInfo>().Cost;
|
||||
var hp = self.Info.Traits.Get<OwnedActorInfo>().HP;
|
||||
|
||||
var costPerHp = (self.World.Defaults.URepairPercent * unitCost) / hp;
|
||||
var hpToRepair = Math.Min(self.World.Defaults.URepairStep, hp - self.Health);
|
||||
var costPerHp = (hostBuilding.Info.Traits.Get<RepairsUnitsInfo>().URepairPercent * unitCost) / hp;
|
||||
var hpToRepair = Math.Min(hostBuilding.Info.Traits.Get<RepairsUnitsInfo>().URepairStep, hp - self.Health);
|
||||
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
|
||||
if (!self.Owner.TakeCash(cost))
|
||||
{
|
||||
@@ -52,8 +55,7 @@ namespace OpenRA.Traits.Activities
|
||||
if (self.Health == hp)
|
||||
return NextActivity;
|
||||
|
||||
var hostBuilding = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
.FirstOrDefault(a => a.traits.Contains<RenderBuilding>());
|
||||
|
||||
|
||||
if (hostBuilding != null)
|
||||
hostBuilding.traits.Get<RenderBuilding>()
|
||||
|
||||
@@ -125,8 +125,8 @@ namespace OpenRA.Traits
|
||||
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||
var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get<BuildableInfo>().Cost;
|
||||
var maxHP = self.Info.Traits.Get<BuildingInfo>().HP;
|
||||
var costPerHp = (self.World.Defaults.URepairPercent * buildingValue) / maxHP;
|
||||
var hpToRepair = Math.Min(self.World.Defaults.URepairStep, maxHP - self.Health);
|
||||
var costPerHp = (self.World.Defaults.RepairPercent * buildingValue) / maxHP;
|
||||
var hpToRepair = Math.Min(self.World.Defaults.RepairStep, maxHP - self.Health);
|
||||
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
|
||||
if (!self.Owner.TakeCash(cost))
|
||||
{
|
||||
|
||||
14
OpenRA.Game/Traits/RepairsUnits.cs
Normal file
14
OpenRA.Game/Traits/RepairsUnits.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
public class RepairsUnitsInfo : StatelessTraitInfo<RepairsUnits>
|
||||
{
|
||||
public readonly float URepairPercent = 0.2f;
|
||||
public readonly int URepairStep = 10;
|
||||
}
|
||||
|
||||
public class RepairsUnits{}
|
||||
}
|
||||
@@ -23,8 +23,7 @@ namespace OpenRA.Traits
|
||||
public readonly float RepairPercent = 0.2f;
|
||||
public readonly float RepairRate = 0.016f;
|
||||
public readonly int RepairStep = 7;
|
||||
public readonly float URepairPercent = 0.2f;
|
||||
public readonly int URepairStep = 10;
|
||||
|
||||
|
||||
/* Combat & Damage */
|
||||
public readonly float TurboBoost = 1.5f;
|
||||
|
||||
@@ -258,6 +258,7 @@ FIX:
|
||||
Sight: 3
|
||||
BelowUnits:
|
||||
Reservable:
|
||||
RepairsUnits:
|
||||
|
||||
HPAD:
|
||||
Inherits: ^Building
|
||||
|
||||
@@ -1736,6 +1736,7 @@ FIX:
|
||||
BelowUnits:
|
||||
Reservable:
|
||||
IronCurtainable:
|
||||
RepairsUnits:
|
||||
|
||||
FACF:
|
||||
Inherits: ^Building
|
||||
|
||||
Reference in New Issue
Block a user