diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index b13e9bdac0..c54729a961 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Buildings public readonly string Footprint = "x"; public readonly int2 Dimensions = new int2(1, 1); public readonly bool Unsellable = false; - public readonly float RefundPercent = 0.5f; + public readonly int RefundPercent = 50; public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"}; public readonly string[] SellSounds = {"cashturn.aud"}; diff --git a/OpenRA.Mods.RA/Buildings/Sell.cs b/OpenRA.Mods.RA/Buildings/Sell.cs index 960e18f13a..0442c55362 100755 --- a/OpenRA.Mods.RA/Buildings/Sell.cs +++ b/OpenRA.Mods.RA/Buildings/Sell.cs @@ -23,13 +23,15 @@ namespace OpenRA.Mods.RA.Buildings void DoSell(Actor self) { + var h = self.TraitOrDefault(); + var bi = self.Info.Traits.Get(); + var pr = self.Owner.PlayerActor.Trait(); var csv = self.Info.Traits.GetOrDefault(); + var cost = csv != null ? csv.Value : self.Info.Traits.Get().Cost; - var health = self.TraitOrDefault(); - var refundFraction = self.Info.Traits.Get().RefundPercent * (health == null ? 1f : health.HPFraction); - - self.Owner.PlayerActor.Trait().GiveCash((int)(refundFraction * cost)); + var refund = (cost * bi.RefundPercent * (h == null ? 1 : h.HP)) / (100 * (h == null ? 1 : h.MaxHP)); + pr.GiveCash(refund); foreach (var ns in self.TraitsImplementing()) ns.Sold(self); diff --git a/OpenRA.Mods.RA/OreRefinery.cs b/OpenRA.Mods.RA/OreRefinery.cs index 8a57b670c2..e063f40135 100644 --- a/OpenRA.Mods.RA/OreRefinery.cs +++ b/OpenRA.Mods.RA/OreRefinery.cs @@ -74,7 +74,8 @@ namespace OpenRA.Mods.RA if (!Info.LocalStorage) return; - if (--nextProcessTime <= 0) { + if (--nextProcessTime <= 0) + { // Convert resources to cash int amount = Math.Min (Ore, Info.ProcessAmount); amount = Math.Min (amount, PlayerResources.OreCapacity - PlayerResources.Ore); @@ -82,7 +83,7 @@ namespace OpenRA.Mods.RA if (amount > 0) { Ore -= amount; - PlayerResources.GiveOre (amount); + PlayerResources.GiveOre(amount); } nextProcessTime = (PlayerPower.PowerState == PowerState.Normal)? Info.ProcessTick : Info.LowPowerProcessTick ; @@ -125,7 +126,7 @@ namespace OpenRA.Mods.RA if (!Info.LocalStorage) return null; - return Graphics.Util.MakeArray (Info.PipCount, i => (Ore * 1f / Info.Capacity > i * 1f / Info.PipCount) ? Info.PipColor : PipType.Transparent); + return Graphics.Util.MakeArray (Info.PipCount, i => (Ore * Info.PipCount > i * Info.Capacity) ? Info.PipColor : PipType.Transparent); } public bool ShouldExplode(Actor self) { return Ore > 0; }