Feature: Bounties added to Buildings/Units at 10% of value + 1.25 for each lvl
This commit is contained in:
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA
|
|||||||
[Sync]
|
[Sync]
|
||||||
int Experience = 0;
|
int Experience = 0;
|
||||||
[Sync]
|
[Sync]
|
||||||
int Level = 0;
|
public int Level { get; private set; }
|
||||||
|
|
||||||
public void GiveOneLevel()
|
public void GiveOneLevel()
|
||||||
{
|
{
|
||||||
|
|||||||
59
OpenRA.Mods.RA/GivesBounty.cs
Normal file
59
OpenRA.Mods.RA/GivesBounty.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class GivesBountyInfo : TraitInfo<GivesBounty>
|
||||||
|
{
|
||||||
|
public readonly int Percentage = 10;
|
||||||
|
public readonly int LevelMod = 125;
|
||||||
|
}
|
||||||
|
|
||||||
|
class GivesBounty : INotifyDamage
|
||||||
|
{
|
||||||
|
|
||||||
|
int GetMultiplier(Actor self)
|
||||||
|
{
|
||||||
|
// returns 100's as 1, so as to keep accuracy for longer.
|
||||||
|
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
||||||
|
var gainsExp = self.TraitOrDefault<GainsExperience>();
|
||||||
|
if (gainsExp == null)
|
||||||
|
return 100;
|
||||||
|
|
||||||
|
var slevel = self.Trait<GainsExperience>().Level;
|
||||||
|
return (slevel > 0) ? slevel * info.LevelMod : 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
if (e.DamageState == DamageState.Dead)
|
||||||
|
{
|
||||||
|
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
||||||
|
// Prevent TK from giving Bounty
|
||||||
|
if (e.Attacker == null || e.Attacker.Destroyed || e.Attacker.Owner.Stances[self.Owner] == Stance.Ally)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var valued = self.Info.Traits.GetOrDefault<ValuedInfo>();
|
||||||
|
var cost = valued != null ? valued.Cost : 0;
|
||||||
|
// 2 hundreds because of GetMultiplier and info.Percentage.
|
||||||
|
var bounty = (int)(cost * GetMultiplier(self) * info.Percentage / 10000);
|
||||||
|
|
||||||
|
e.Attacker.World.AddFrameEndTask(w => w.Add(new CashTick(bounty, 20, 1, self.CenterLocation, e.Attacker.Owner.ColorRamp.GetColor(0))));
|
||||||
|
|
||||||
|
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(bounty);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>9.0.21022</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{4A8A43B5-A9EF-4ED0-99DD-4BAB10A0DB6E}</ProjectGuid>
|
<ProjectGuid>{4A8A43B5-A9EF-4ED0-99DD-4BAB10A0DB6E}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AcceptsSupplies.cs" />
|
<Compile Include="AcceptsSupplies.cs" />
|
||||||
<Compile Include="Activities\Attack.cs" />
|
<Compile Include="Activities\Attack.cs" />
|
||||||
<Compile Include="Activities\CallFunc.cs" />
|
<Compile Include="Activities\CallFunc.cs" />
|
||||||
<Compile Include="Activities\CaptureBuilding.cs" />
|
<Compile Include="Activities\CaptureBuilding.cs" />
|
||||||
<Compile Include="Activities\DonateSupplies.cs" />
|
<Compile Include="Activities\DonateSupplies.cs" />
|
||||||
<Compile Include="Activities\QueuedActivity.cs" />
|
<Compile Include="Activities\QueuedActivity.cs" />
|
||||||
<Compile Include="Activities\DeliverOre.cs" />
|
<Compile Include="Activities\DeliverOre.cs" />
|
||||||
<Compile Include="Activities\Demolish.cs" />
|
<Compile Include="Activities\Demolish.cs" />
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
<Compile Include="Air\EjectOnDeath.cs" />
|
<Compile Include="Air\EjectOnDeath.cs" />
|
||||||
<Compile Include="Buildings\Sellable.cs" />
|
<Compile Include="Buildings\Sellable.cs" />
|
||||||
<Compile Include="Effects\CashTick.cs" />
|
<Compile Include="Effects\CashTick.cs" />
|
||||||
|
<Compile Include="GivesBounty.cs" />
|
||||||
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
||||||
<Compile Include="ProductionBar.cs" />
|
<Compile Include="ProductionBar.cs" />
|
||||||
<Compile Include="Render\RenderEditorOnly.cs" />
|
<Compile Include="Render\RenderEditorOnly.cs" />
|
||||||
@@ -109,7 +110,7 @@
|
|||||||
<Compile Include="Buildings\TechTree.cs" />
|
<Compile Include="Buildings\TechTree.cs" />
|
||||||
<Compile Include="Buildings\Util.cs" />
|
<Compile Include="Buildings\Util.cs" />
|
||||||
<Compile Include="ProximityCaptor.cs" />
|
<Compile Include="ProximityCaptor.cs" />
|
||||||
<Compile Include="SupplyTruck.cs" />
|
<Compile Include="SupplyTruck.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
||||||
<Compile Include="Valued.cs" />
|
<Compile Include="Valued.cs" />
|
||||||
<Compile Include="Combat.cs" />
|
<Compile Include="Combat.cs" />
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
Notification: unitlst1.aud
|
Notification: unitlst1.aud
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Vehicle
|
Types:Vehicle
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Tank:
|
^Tank:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Mobile:
|
Mobile:
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
Notification: unitlst1.aud
|
Notification: unitlst1.aud
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Tank
|
Types:Tank
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Infantry:
|
^Infantry:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -93,6 +95,7 @@
|
|||||||
Notification: unitlst1.aud
|
Notification: unitlst1.aud
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Infantry
|
Types:Infantry
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Ship:
|
^Ship:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -115,6 +118,7 @@
|
|||||||
Notification: navylst1.aud
|
Notification: navylst1.aud
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Ship
|
Types:Ship
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Plane:
|
^Plane:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -139,6 +143,7 @@
|
|||||||
EjectOnDeath:
|
EjectOnDeath:
|
||||||
PilotActor: E1
|
PilotActor: E1
|
||||||
SuccessRate: 50
|
SuccessRate: 50
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Building:
|
^Building:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -168,6 +173,7 @@
|
|||||||
Types:Building
|
Types:Building
|
||||||
Sellable:
|
Sellable:
|
||||||
AcceptsSupplies:
|
AcceptsSupplies:
|
||||||
|
GivesBounty:
|
||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
|||||||
Reference in New Issue
Block a user