1
0
forked from 0ad/0ad

#Several gameplay changes:

#- Modified female citizen gather rates and aura effects.
#- Units automatically go gather nearby resources when done building a
dropsite.
#- Ore renamed to metal.

This was SVN commit r4594.
This commit is contained in:
Matei 2006-10-26 21:35:25 +00:00
parent c56f6f1055
commit acea9cc2a3
16 changed files with 141 additions and 66 deletions

View File

@ -1,5 +1,5 @@
food,Food,
wood,Wood,
stone,Stone,
ore,Ore,
metal,Metal,
population,Population,

View File

@ -20,7 +20,7 @@
</Id>
<MiniMap>
<Type>Ore</Type>
<Type>Metal</Type>
<Red>192</Red>
<Green>192</Green>
<Blue>0</Blue>
@ -28,7 +28,7 @@
<Supply>
<Max>500</Max>
<Type>ore</Type>
<Type>metal</Type>
</Supply>
</Traits>

View File

@ -51,7 +51,7 @@
<Food/>
<Wood/>
<Stone/>
<Ore/>
<Metal/>
</Types>
<r>0.1</r>
<g>0.2</g>

View File

@ -49,7 +49,7 @@
<Food />
<Wood />
<Stone />
<Ore />
<Metal />
</List>
</Barter>
</Actions>

View File

@ -13,9 +13,9 @@
<Icon_Cell>52</Icon_Cell>
<Classes>Village</Classes>
<Classes>Village, Mill</Classes>
<Rollover>A Mill must be constructed near a source of Wood, Stone or Ore in order to collect them. It also provides technologies that improve gathering of these resources.</Rollover>
<Rollover>A Mill must be constructed near a source of Wood, Stone or Metal in order to collect them. It also provides technologies that improve gathering of these resources.</Rollover>
</Id>
@ -40,7 +40,7 @@
<Types>
<Wood/>
<Stone/>
<Ore/>
<Metal/>
</Types>
<r>0.1</r>
<g>0.2</g>

View File

@ -36,7 +36,7 @@
<Food>1</Food>
<wood>1</wood>
<Stone>1</Stone>
<Ore>1</Ore>
<Metal>1</Metal>
</Loot>
<Population>
@ -58,9 +58,10 @@
<Gather>
<Resource>
<Food>
<Meat>2</Meat>
<Meat>15</Meat>
</Food>
</Resource>
<AffectedByAllure>true</AffectedByAllure>
<Range>2.0</Range>
<Speed>3000</Speed>
</Gather>

View File

@ -28,7 +28,7 @@
<Food>1</Food>
<wood>1</wood>
<Stone>1</Stone>
<Ore>1</Ore>
<Metal>1</Metal>
</Loot>
<MiniMap>

View File

@ -27,7 +27,7 @@
<Food>1</Food>
<Wood>1</Wood>
<Stone>1</Stone>
<Ore>1</Ore>
<Metal>1</Metal>
</Loot>
<Population>
@ -69,15 +69,16 @@
<Gather>
<Resource>
<Food>
<Fruit>20</Fruit>
<Grain>20</Grain>
<Fish>20</Fish>
<Milk>20</Milk>
<Fruit>10</Fruit>
<Grain>10</Grain>
<Fish>10</Fish>
<Milk>10</Milk>
</Food>
<Wood>10</Wood>
<Stone>10</Stone>
<Ore>10</Ore>
<Metal>10</Metal>
</Resource>
<AffectedByAllure>true</AffectedByAllure>
<Range>2.0</Range>
<Speed>3000</Speed>
</Gather>

View File

@ -22,7 +22,7 @@
<Food>1</Food>
<wood>1</wood>
<Stone>1</Stone>
<Ore>1</Ore>
<Metal>1</Metal>
</Loot>
</Traits>

View File

@ -22,7 +22,7 @@
<Food>1</Food>
<wood>1</wood>
<Stone>1</Stone>
<Ore>1</Ore>
<Metal>1</Metal>
</Loot>
<MiniMap>

View File

@ -18,13 +18,20 @@
<Auras>
<Infidelity>
<Radius>30</Radius>
<Radius>25</Radius>
<Time>10</Time>
<r>0.8</r>
<g>0.8</g>
<b>1.0</b>
<a>0.5</a>
</Infidelity>
<Allure>
<Radius>25</Radius>
<r>0.8</r>
<g>0.8</g>
<b>1.0</b>
<a>0.5</a>
</Allure>
</Auras>
</Traits>
@ -47,11 +54,14 @@
<Gather>
<Resource>
<Food>
<Fruit>5</Fruit>
<Grain>5</Grain>
<Fish>5</Fish>
<Milk>5</Milk>
<Fruit>20</Fruit>
<Grain>20</Grain>
<Fish>20</Fish>
<Milk>20</Milk>
</Food>
<Wood>15</Wood>
<Metal>15</Metal>
<Stone>15</Stone>
</Resource>
<Range>2.0</Range>
<Speed>3000</Speed>

View File

@ -12,13 +12,13 @@ function createResourceCounters()
addResourceCounter(0, "food");
addResourceCounter(1, "wood");
addResourceCounter(2, "stone");
addResourceCounter(3, "ore");
addResourceCounter(3, "metal");
addResourceCounter(4, "population");
refreshResource("Food", 0);
refreshResource("Wood", 1);
refreshResource("Stone", 2);
refreshResource("Ore", 3);
refreshResource("Metal", 3);
refreshResource("Population", 4);
}

View File

@ -90,6 +90,7 @@ function entityInit( evt )
this.GotoInRange = GotoInRange;
this.attachAuras = attachAuras;
this.setupRank = setupRank;
this.chooseGatherTarget = chooseGatherTarget;
// Some temp variables to speed up property access
var id = this.traits.id;
@ -256,6 +257,11 @@ function entityInit( evt )
}
}
// Set up allure counter
if (this.actions && this.actions.gather && this.actions.gather.affectedByAllure)
{
this.allureCount = 0;
}
stopXTimer(5);
/*
@ -457,40 +463,49 @@ function setupRank()
// attached to them only when they finish construction.
function attachAuras()
{
if( this.traits.auras )
// Add all auras defined in this.traits.auras
var t = this.traits.auras;
var a;
if( t )
{
if( this.traits.auras.courage )
if( t.courage )
{
a = this.traits.auras.courage;
a = t.courage;
this.addAura ( "courage", a.radius, 0, a.r, a.g, a.b, a.a, new DamageModifyAura( this, true, a.bonus ) );
}
if( this.traits.auras.fear )
if( t.fear )
{
a = this.traits.auras.fear;
a = t.fear;
this.addAura ( "fear", a.radius, 0, a.r, a.g, a.b, a.a, new DamageModifyAura( this, false, -a.bonus ) );
}
if( this.traits.auras.infidelity )
if( t.infidelity )
{
a = this.traits.auras.infidelity;
a = t.infidelity;
this.addAura ( "infidelity", a.radius, 0, a.r, a.g, a.b, a.a, new InfidelityAura( this, a.time ) );
}
if( this.traits.auras.dropsite )
if( t.dropsite )
{
a = this.traits.auras.dropsite;
a = t.dropsite;
this.addAura ( "dropsite", a.radius, 0, a.r, a.g, a.b, a.a, new DropsiteAura( this, a.types ) );
}
if( this.traits.auras.heal )
if( t.heal )
{
a = this.traits.auras.heal;
a = t.heal;
this.addAura ( "heal", a.radius, a.speed, a.r, a.g, a.b, a.a, new HealAura( this ) );
}
if( this.traits.auras.trample )
if( t.trample )
{
a = this.traits.auras.trample;
a = t.trample;
this.addAura ( "trample", a.radius, a.speed, a.r, a.g, a.b, a.a, new TrampleAura( this ) );
}
if( t.allure )
{
a = t.allure;
this.addAura ( "allure", a.radius, 0, a.r, a.g, a.b, a.a, new AllureAura( this ) );
}
}
// Settlements also get a special aura that will let them change player when a Civ Centre is built on top
if( this.hasClass("Settlement") )
{
this.addAura ( "settlement", 1.0, 0, 0.0, 0.0, 0.0, 0.0, new SettlementAura( this ) );
@ -676,10 +691,14 @@ function performGather( evt )
return;
}
var allureMod = 1;
if( g.affectedByAllure && this.allureCount > 0 )
allureMod = 1.2;
if( g.resource[s.type][s.subType])
gather_amt = parseFloat( g.resource[s.type][s.subType] );
gather_amt = parseFloat( g.resource[s.type][s.subType] * allureMod );
else
gather_amt = parseFloat( g.resource[s.type] );
gather_amt = parseFloat( g.resource[s.type] * allureMod );
if( s.max > 0 )
{
@ -1065,28 +1084,8 @@ function entityEventTargetExhausted( evt )
{
if( evt.action == ACTION_GATHER )
{
// Look for other stuff of the same kind to gather
var visible = this.getVisibleEntities();
var bestDist = 1e20;
var bestTarget = null;
for( var i=0; i<visible.length; i++ )
{
var e = visible[i];
if( canGather( this, e )
&& e.traits.supply.subType.toString() == evt.target.traits.supply.subType.toString() )
{
var dist = this.getDistance( e );
if( dist < bestDist )
{
bestDist = dist;
bestTarget = e;
}
}
}
if( bestTarget != null )
{
this.order( ORDER_GENERIC, bestTarget, ACTION_GATHER );
}
// Look for other resources of the same type to gather
this.chooseGatherTarget( evt.target.traits.supply.subType.toString() );
}
else if( evt.action == ACTION_BUILD )
{
@ -1111,9 +1110,42 @@ function entityEventTargetExhausted( evt )
{
this.order( ORDER_GENERIC, bestTarget, ACTION_BUILD );
}
else if( evt.target.hasClass("Village") )
{
// Nothing to build, but try to gather any resource around us
this.chooseGatherTarget( null, evt.target.getVisibleEntities() );
}
}
}
function chooseGatherTarget( resourceSubType, targetList )
{
if( !targetList )
targetList = this.getVisibleEntities();
var bestDist = 1e20;
var bestTarget = null;
for( var i=0; i<targetList.length; i++ )
{
var e = targetList[i];
if( canGather( this, e )
&& ( !resourceSubType || e.traits.supply.subType.toString() == resourceSubType ) )
{
var dist = this.getDistance( e );
if( dist < bestDist )
{
bestDist = dist;
bestTarget = e;
}
}
}
if( bestTarget != null )
{
this.order( ORDER_GENERIC, bestTarget, ACTION_GATHER );
return true;
}
return false;
}
// ====================================================================
function entityEventTargetChanged( evt )
@ -1356,7 +1388,7 @@ function entityStartConstruction( evt )
// ====================================================================
const TECH_RESOURCES = new Array("food", "wood", "stone", "ore");
const TECH_RESOURCES = new Array("food", "wood", "stone", "metal");
function entityStartProduction( evt )
{
@ -2081,6 +2113,37 @@ function SettlementAura( source )
// ====================================================================
function AllureAura( source )
{
// Defines the effects of the Allure Aura. (Adjacent male units owned by the same player gather faster.)
this.source = source;
this.affects = function( e )
{
return ( e.player.id == this.source.player.id && e.actions && e.actions.gather
&& e.actions.gather.affectedByAllure );
}
this.onEnter = function( e )
{
if( this.affects( e ) )
{
e.allureCount++;
}
};
this.onExit = function( e )
{
if( this.affects( e ) )
{
e.allureCount--;
}
};
}
// ====================================================================
function GotoInRange( x, y, run )
{
if ( !this.actions || !this.actions.move )

View File

@ -15,13 +15,13 @@ for(var i=0; i<players.length; i++)
case "high":
p.resources.food = 1000;
p.resources.wood = 1000;
p.resources.ore = 500;
p.resources.metal = 500;
p.resources.stone = 500;
break;
default:
p.resources.food = 200;
p.resources.wood = 200;
p.resources.ore = 100;
p.resources.metal = 100;
p.resources.stone = 100;
break;
}