Ditto Player, Shroud, and Smudge

This commit is contained in:
Bob
2010-01-21 13:41:22 +13:00
parent 6ac384669b
commit bb5f7dac6b
4 changed files with 19 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
using OpenRa.GameRules;
using OpenRa.FileFormats;
namespace OpenRa
{
@@ -8,11 +9,11 @@ namespace OpenRa
const int firstCrater = 17;
const int framesPerCrater = 5;
public static void AddSmudge(bool isCrater, int x, int y)
public static void AddSmudge(this Map map, bool isCrater, int x, int y)
{
var smudge = Game.world.Map.MapTiles[x, y].smudge;
var smudge = map.MapTiles[x, y].smudge;
if (smudge == 0)
Game.world.Map.MapTiles[x, y].smudge = (byte) (isCrater
map.MapTiles[x, y].smudge = (byte) (isCrater
? (firstCrater + framesPerCrater * ChooseSmudge())
: (firstScorch + ChooseSmudge()));
@@ -21,21 +22,21 @@ namespace OpenRa
/* deepen the crater */
var amount = (smudge - firstCrater) % framesPerCrater;
if (amount < framesPerCrater - 1)
Game.world.Map.MapTiles[x, y].smudge++;
map.MapTiles[x, y].smudge++;
}
public static void AddSmudge(int2 targetTile, WarheadInfo warhead)
public static void AddSmudge(this Map map, int2 targetTile, WarheadInfo warhead)
{
switch (warhead.Explosion) /* todo: push the scorch/crater behavior into data */
{
case 4:
case 5:
Smudge.AddSmudge(true, targetTile.X, targetTile.Y);
map.AddSmudge(true, targetTile.X, targetTile.Y);
break;
case 3:
case 6:
Smudge.AddSmudge(false, targetTile.X, targetTile.Y);
map.AddSmudge(false, targetTile.X, targetTile.Y);
break;
}
}