Fix polymorph. Some more doc work.
This commit is contained in:
parent
ce466b082c
commit
9854f9f3ce
7 changed files with 210 additions and 117 deletions
doc/script
src
|
@ -34,113 +34,29 @@
|
|||
<a href="script-index.html">Script index</a>
|
||||
<hr>
|
||||
<a href="stratagus.html">Stratagus.*</a>
|
||||
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
|
||||
<a href="players.html">Stratagus.Players.*</a>
|
||||
<hr>
|
||||
<dl>
|
||||
<!-- SCRIPT -->
|
||||
<a name="Stratagus.MissileTypes[].Ident">
|
||||
<dt><b>Stratagus.MissileTypes[].Ident</b></dt>
|
||||
<dd><b>Type:</b> string </dd>
|
||||
<dd>The missile type's name. By tradition you should use something like
|
||||
"missile-small-arrow". Read-only.</dd>
|
||||
<a name="Stratagus.MissileTypes[].File">
|
||||
<dt><b>Stratagus.MissileTypes[].File</b></dt>
|
||||
<dd><b>Type:</b> string (filename) </dd>
|
||||
<dd>Filename with missile graphics. Relative to
|
||||
<a href="stratagus.html#Stratagus.LibraryFilePath">Stratagus.LibaryFilePath</a></dd>
|
||||
<a name="Stratagus.MissileTypes[].Transparency">
|
||||
<dt><b>Stratagus.MissileTypes[].Transparency</b></dt>
|
||||
<dd><b>Type:</b> int (byte) </dd>
|
||||
<dd>This is the transparency value for the missile. Value should be between
|
||||
0(completely transparent) and 256(completely opaque). NOT TESTED</dd>
|
||||
<a name="Stratagus.MissileTypes[].Width">
|
||||
<dt><b>Stratagus.MissileTypes[].Width</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the width of one frame in the graphic file.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Height">
|
||||
<dt><b>Stratagus.MissileTypes[].Height</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the height of one frame in the graphic file.</dd>
|
||||
<a name="Stratagus.MissileTypes[].DrawLevel">
|
||||
<dt><b>Stratagus.MissileTypes[].DrawLevel</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>Drawing level. Missiles and units are sorted by this value. We need to
|
||||
add details on the actual implementation of the sort.</dd>
|
||||
<a name="Stratagus.MissileTypes[].SpriteFrames">
|
||||
<dt><b>Stratagus.MissileTypes[].SpriteFrames</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>The number of the frames for this sprite. Missile animation is trivial,
|
||||
It will go through the Sprite frames in order</dd>
|
||||
<a name="Stratagus.MissileTypes[].NumDirections">
|
||||
<dt><b>Stratagus.MissileTypes[].NumDirections</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>The number of the directions for the missile. Inside the graphic file
|
||||
sprites are arranged first by frame then by direction. Line x is for frame
|
||||
x, column y for dirrection y. Directions are considered to be equally spaced.</dd>
|
||||
<a name="Stratagus.MissileTypes[].NumBounces">
|
||||
<dt><b>Stratagus.MissileTypes[].NumBounces</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>You can make missiles bounce, the obvious example is fireballs in warcraft 2.
|
||||
After hitting it's destination point, the missile will "bounce" and keep going
|
||||
hitting "NumBounces" times every tile and a half(haredcoded, sorry)</dd>
|
||||
<a name="Stratagus.MissileTypes[].Sleep">
|
||||
<dt><b>Stratagus.MissileTypes[].Sleep</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This are the number of game cycles to wait between two animation steps.
|
||||
All animation steps are equally spaced.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Speed">
|
||||
<dt><b>Stratagus.MissileTypes[].Speed</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the number of pixels the missile moves for every animation frame.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Range">
|
||||
<dt><b>Stratagus.MissileTypes[].Range</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is <b>NOT</b> the maximum range you can fire the missile at. It's the
|
||||
range for splash damage. 0 affects a single unit, otherwise it's the number of
|
||||
tiles around the hit that get affected.</dd>
|
||||
<a name="Stratagus.MissileTypes[].SplashFactor">
|
||||
<dt><b>Stratagus.MissileTypes[].SplashFactor</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the factor for splash damage. The first tile gets full damage,
|
||||
a tile x away from the center get damage / (x * SplashFactor)</dd>
|
||||
<a name="Stratagus.MissileTypes">
|
||||
<dt><b>Stratagus.MissileTypes</b></dt>
|
||||
<dd><b>Type:</b> missile collection </dd>
|
||||
<dd>This is the collection of missile types. every missile type has a name,
|
||||
generally prefixed with "missile-". You have to use .Create to create a new
|
||||
missile type.</dd>
|
||||
<a name="Stratagus.MissileTypes[].CanHitOwner">
|
||||
<dt><b>Stratagus.MissileTypes[].CanHitOwner</b></dt>
|
||||
<dd><b>Type:</b> boolean </dd>
|
||||
<dd>This is true if the missile can hit it's owner (unit that fired it most
|
||||
of the time) or false otherwise. Do not confuse this with
|
||||
<a href="missiletypes.html#Stratagus.MissileTypes[].FriendlyFire">FriendlyFire</a></dd>
|
||||
<a name="Stratagus.MissileTypes[].FriendlyFire">
|
||||
<dt><b>Stratagus.MissileTypes[].FriendlyFire</b></dt>
|
||||
<dd><b>Type:</b> boolean </dd>
|
||||
<dd>This is false if the missile can hit units that are allied with the owner. This
|
||||
includes units of the missile's owner. It also makes
|
||||
<a href="missiletypes.html#Stratagus.MissileTypes[].CanHitOwner">CanHitOwner</a>
|
||||
useless if it's false.</dd>
|
||||
<a name="Stratagus.MissileTypes[].ImpactMissile">
|
||||
<dt><b>Stratagus.MissileTypes[].ImpactMissile</b></dt>
|
||||
<dd><b>Type:</b> string, missile-ident </dd>
|
||||
<dd>This string is the name of a missile to be spawned when the unit hits. It will
|
||||
spawn multiple times for
|
||||
<a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">NumBounces</a>.
|
||||
Can also be nil, to disable it.
|
||||
<a name="Stratagus.MissileTypes[].SmokeMissile">
|
||||
<dt><b>Stratagus.MissileTypes[].SmokeMissile</b></dt>
|
||||
<dd><b>Type:</b> string, missile-ident </dd>
|
||||
<dd>This string is the name of a missile to be spawned every "once in a while" as
|
||||
smoke. Can also be nil, to disable it. NOT TESTED</dd>
|
||||
<a name="Stratagus.MissileTypes[].FiredSound">
|
||||
<dt><b>Stratagus.MissileTypes[].FiredSound</b></dt>
|
||||
<dd><b>Type:</b> string, sound-ident </dd>
|
||||
<dd>Sound to be played when the missile is fired. Can also be nil, to disable it.</dd>
|
||||
<a name="Stratagus.MissileTypes[].ImpactSound">
|
||||
<dt><b>Stratagus.MissileTypes[].ImpactSound</b></dt>
|
||||
<dd><b>Type:</b> string, sound-ident </dd>
|
||||
<dd>Sound to be played the missile hits it's target. Can be nil to disable it.</dd>
|
||||
<a name="Stratagus.MissileType[].Class">
|
||||
<dt><b>Stratagus.MissileTypes[].CLass</b></dt>
|
||||
<a name="Stratagus.MissileTypes[].Class">
|
||||
<dt><b>Stratagus.MissileTypes[].Class</b></dt>
|
||||
<dd><b>Type:</b> string, special values only </dd>
|
||||
<dd>This is probably the most interesting part of the MissileType. It can receive a
|
||||
number of string values, that influence the exact behaviour and trajectory of the
|
||||
missile when it is fired. Here is a list of possible values. </dd>
|
||||
missile when it is fired. Here is a list of possible values.</dd>
|
||||
<dl>
|
||||
<dt><i>missile-class-none</i></dt>
|
||||
<dd>Missile does nothing. Shouldn't really be used.</dd>
|
||||
|
@ -179,7 +95,99 @@
|
|||
<dd>Missile is death coil, will drain health from target or enemy units
|
||||
in the area and feed it to the caster.<b>FIXME more configurable</b></dd>
|
||||
</dl>
|
||||
<!-- SCRIPT -->
|
||||
<a name="Stratagus.MissileTypes[].DrawLevel">
|
||||
<dt><b>Stratagus.MissileTypes[].DrawLevel</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>Drawing level. Missiles and units are sorted by this value. We need to
|
||||
add details on the actual implementation of the sort.</dd>
|
||||
<a name="Stratagus.MissileTypes[].File">
|
||||
<dt><b>Stratagus.MissileTypes[].File</b></dt>
|
||||
<dd><b>Type:</b> string (filename) </dd>
|
||||
<dd>Filename with missile graphics. Relative to
|
||||
<a href="stratagus.html#Stratagus.LibraryFilePath">Stratagus.LibaryFilePath</a></dd>
|
||||
<a name="Stratagus.MissileTypes[].FiredSound">
|
||||
<dt><b>Stratagus.MissileTypes[].FiredSound</b></dt>
|
||||
<dd><b>Type:</b> string, sound-ident </dd>
|
||||
<dd>Sound to be played when the missile is fired. Can also be nil, to disable it.</dd>
|
||||
<a name="Stratagus.MissileTypes[].FriendlyFire">
|
||||
<dt><b>Stratagus.MissileTypes[].FriendlyFire</b></dt>
|
||||
<dd><b>Type:</b> boolean </dd>
|
||||
<dd>This is false if the missile can hit units that are allied with the owner. This
|
||||
includes units of the missile's owner. It also makes
|
||||
<a href="missiletypes.html#Stratagus.MissileTypes[].CanHitOwner">CanHitOwner</a>
|
||||
useless if it's false.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Height">
|
||||
<dt><b>Stratagus.MissileTypes[].Height</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the height of one frame in the graphic file.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Ident">
|
||||
<dt><b>Stratagus.MissileTypes[].Ident</b></dt>
|
||||
<dd><b>Type:</b> string </dd>
|
||||
<dd>The missile type's name. By tradition you should use something like
|
||||
"missile-small-arrow". Read-only.</dd>
|
||||
<a name="Stratagus.MissileTypes[].ImpactMissile">
|
||||
<dt><b>Stratagus.MissileTypes[].ImpactMissile</b></dt>
|
||||
<dd><b>Type:</b> string, missile-ident </dd>
|
||||
<dd>This string is the name of a missile to be spawned when the unit hits. It will
|
||||
spawn multiple times for
|
||||
<a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">NumBounces</a>.
|
||||
Can also be nil, to disable it.
|
||||
<a name="Stratagus.MissileTypes[].ImpactSound">
|
||||
<dt><b>Stratagus.MissileTypes[].ImpactSound</b></dt>
|
||||
<dd><b>Type:</b> string, sound-ident </dd>
|
||||
<dd>Sound to be played the missile hits it's target. Can be nil to disable it.</dd>
|
||||
<a name="Stratagus.MissileTypes[].NumBounces">
|
||||
<dt><b>Stratagus.MissileTypes[].NumBounces</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>You can make missiles bounce, the obvious example is fireballs in warcraft 2.
|
||||
After hitting it's destination point, the missile will "bounce" and keep going
|
||||
hitting "NumBounces" times every tile and a half(haredcoded, sorry)</dd>
|
||||
<a name="Stratagus.MissileTypes[].NumDirections">
|
||||
<dt><b>Stratagus.MissileTypes[].NumDirections</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>The number of the directions for the missile. Inside the graphic file
|
||||
sprites are arranged first by frame then by direction. Line x is for frame
|
||||
x, column y for dirrection y. Directions are considered to be equally spaced.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Range">
|
||||
<dt><b>Stratagus.MissileTypes[].Range</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is <b>NOT</b> the maximum range you can fire the missile at. It's the
|
||||
range for splash damage. 0 affects a single unit, otherwise it's the number of
|
||||
tiles around the hit that get affected.</dd>
|
||||
<a name="Stratagus.MissileTypes[].Sleep">
|
||||
<dt><b>Stratagus.MissileTypes[].Sleep</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This are the number of game cycles to wait between two animation steps.
|
||||
All animation steps are equally spaced.</dd>
|
||||
<a name="Stratagus.MissileTypes[].SmokeMissile">
|
||||
<dt><b>Stratagus.MissileTypes[].SmokeMissile</b></dt>
|
||||
<dd><b>Type:</b> string, missile-ident </dd>
|
||||
<dd>This string is the name of a missile to be spawned every "once in a while" as
|
||||
smoke. Can also be nil, to disable it. NOT TESTED</dd>
|
||||
<a name="Stratagus.MissileTypes[].Speed">
|
||||
<dt><b>Stratagus.MissileTypes[].Speed</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the number of pixels the missile moves for every animation frame.</dd>
|
||||
<a name="Stratagus.MissileTypes[].SplashFactor">
|
||||
<dt><b>Stratagus.MissileTypes[].SplashFactor</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the factor for splash damage. The first tile gets full damage,
|
||||
a tile x away from the center get damage / (x * SplashFactor)</dd>
|
||||
<a name="Stratagus.MissileTypes[].SpriteFrames">
|
||||
<dt><b>Stratagus.MissileTypes[].SpriteFrames</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>The number of the frames for this sprite. Missile animation is trivial,
|
||||
It will go through the Sprite frames in order</dd>
|
||||
<a name="Stratagus.MissileTypes[].Transparency">
|
||||
<dt><b>Stratagus.MissileTypes[].Transparency</b></dt>
|
||||
<dd><b>Type:</b> int (byte) </dd>
|
||||
<dd>This is the transparency value for the missile. Value should be between
|
||||
0(completely transparent) and 256(completely opaque). NOT TESTED</dd>
|
||||
<a name="Stratagus.MissileTypes[].Width">
|
||||
<dt><b>Stratagus.MissileTypes[].Width</b></dt>
|
||||
<dd><b>Type:</b> int </dd>
|
||||
<dd>This is the width of one frame in the graphic file.</dd>
|
||||
<!-- SCRIPT -->
|
||||
</dl><hr>
|
||||
Last changed: $Id$<br>
|
||||
All trademarks and copyrights on this page are owned by their respective owners.
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<a href="script-index.html">Script index</a>
|
||||
<hr>
|
||||
<a href="stratagus.html">Stratagus.*</a>
|
||||
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
|
||||
<a href="players.html">Stratagus.Players.*</a>
|
||||
<hr>
|
||||
|
||||
<dl>
|
||||
|
@ -41,6 +43,48 @@
|
|||
<dt><a href="stratagus.html#Stratagus.GameName">Stratagus.GameName</a></dt>
|
||||
<dt><a href="stratagus.html#Stratagus.GamePaused">Stratagus.GamePaused</a></dt>
|
||||
<dt><a href="stratagus.html#Stratagus.LibraryFilePath">Stratagus.LibraryFilePath</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes">Stratagus.MissileTypes</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].CanHitOwner">Stratagus.MissileTypes[].CanHitOwner</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Class">Stratagus.MissileTypes[].Class</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].DrawLevel">Stratagus.MissileTypes[].DrawLevel</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].File">Stratagus.MissileTypes[].File</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].FiredSound">Stratagus.MissileTypes[].FiredSound</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].FriendlyFire">Stratagus.MissileTypes[].FriendlyFire</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Height">Stratagus.MissileTypes[].Height</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Ident">Stratagus.MissileTypes[].Ident</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].ImpactMissile">Stratagus.MissileTypes[].ImpactMissile</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].ImpactSound">Stratagus.MissileTypes[].ImpactSound</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">Stratagus.MissileTypes[].NumBounces</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].NumDirections">Stratagus.MissileTypes[].NumDirections</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Range">Stratagus.MissileTypes[].Range</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Sleep">Stratagus.MissileTypes[].Sleep</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SmokeMissile">Stratagus.MissileTypes[].SmokeMissile</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Speed">Stratagus.MissileTypes[].Speed</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SplashFactor">Stratagus.MissileTypes[].SplashFactor</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SpriteFrames">Stratagus.MissileTypes[].SpriteFrames</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Transparency">Stratagus.MissileTypes[].Transparency</a></dt>
|
||||
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Width">Stratagus.MissileTypes[].Width</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players">Stratagus.Players</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Allied">Stratagus.Players[].Allied</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].BuildingLimit">Stratagus.Players[].BuildingLimit</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Demand">Stratagus.Players[].Demand</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Enemy">Stratagus.Players[].Enemy</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Name">Stratagus.Players[].Name</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].NumBuildings">Stratagus.Players[].NumBuildings</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].NumUnits">Stratagus.Players[].NumUnits</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Score">Stratagus.Players[].Score</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].SharedVision">Stratagus.Players[].SharedVision</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Slot">Stratagus.Players[].Slot</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].StartX">Stratagus.Players[].StartX</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].StartY">Stratagus.Players[].StartY</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].Supply">Stratagus.Players[].Supply</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].TotalBuildings">Stratagus.Players[].TotalBuildings</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].TotalKills">Stratagus.Players[].TotalKills</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].TotalRazings">Stratagus.Players[].TotalRazings</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].TotalUnitLimit">Stratagus.Players[].TotalUnitLimit</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].TotalUnits">Stratagus.Players[].TotalUnits</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].UnitLimit">Stratagus.Players[].UnitLimit</a></dt>
|
||||
<dt><a href="players.html#Stratagus.Players[].UnitTypesCount">Stratagus.Players[].UnitTypesCount</a></dt>
|
||||
<!-- SCRIPT -->
|
||||
</dl>
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<a href="script-index.html">Script index</a>
|
||||
<hr>
|
||||
<a href="stratagus.html">Stratagus.*</a>
|
||||
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
|
||||
<a href="players.html">Stratagus.Players.*</a>
|
||||
<hr>
|
||||
|
||||
<h2>Intro - Introduction to scripting in Stratagus</h2>
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<a href="script-index.html">Script index</a>
|
||||
<hr>
|
||||
<a href="stratagus.html">Stratagus.*</a>
|
||||
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
|
||||
<a href="players.html">Stratagus.Players.*</a>
|
||||
<hr>
|
||||
<dl>
|
||||
<!-- SCRIPT -->
|
||||
|
@ -56,6 +58,18 @@
|
|||
<dd><b>Type:</b> string </dd>
|
||||
<dd>This is the path for the stratagus data dir, the one you specify
|
||||
with -d on the command line.</dd>
|
||||
<a name="Stratagus.SyncRand()">
|
||||
<dt><b>Stratagus.SyncRand()</b></dt>
|
||||
<dd><b>Type:</b> function, returns int </dd>
|
||||
<dd>This calls the internal stratagus syncronized random number generator.
|
||||
It will get the same values across multiplayer games. Make sure you
|
||||
don't call it from unsincronized parts of the game.</dd>
|
||||
<a name="Stratagus.MyRand()">
|
||||
<dt><b>Stratagus.MyRand()</b></dt>
|
||||
<dd><b>Type:</b> function, returns int </dd>
|
||||
<dd>This calls a random number generator. Do not use this in map
|
||||
scripts or anything else that has to behave the same across multiplayer
|
||||
games.</dd>
|
||||
<!-- SCRIPT -->
|
||||
</dl><hr>
|
||||
Last changed: $Id$<br>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#define NEW_UNIT_CACHE
|
||||
|
||||
// New Lua scripting.
|
||||
//#define META_LUA
|
||||
#define META_LUA
|
||||
|
||||
// Dynamic loading.
|
||||
//#define DYNAMIC_LOAD
|
||||
|
|
|
@ -565,6 +565,9 @@ global int CastAdjustVitals(Unit* caster, const SpellType* spell,
|
|||
global int CastPolymorph(Unit* caster, const SpellType* spell,
|
||||
const SpellActionType* action, Unit* target, int x, int y)
|
||||
{
|
||||
int canplace;
|
||||
int i;
|
||||
int j;
|
||||
UnitType* type;
|
||||
|
||||
DebugCheck(!caster);
|
||||
|
@ -575,32 +578,52 @@ global int CastPolymorph(Unit* caster, const SpellType* spell,
|
|||
type = action->Data.Polymorph.NewForm;
|
||||
DebugCheck(!type);
|
||||
|
||||
x = x - type->TileWidth / 2;
|
||||
y = y - type->TileHeight / 2;
|
||||
|
||||
caster->Player->Score += target->Type->Points;
|
||||
if (target->Type->Building) {
|
||||
caster->Player->TotalRazings++;
|
||||
} else {
|
||||
caster->Player->TotalKills++;
|
||||
}
|
||||
if (IsEnemy(caster->Player, target)) {
|
||||
if (target->Type->Building) {
|
||||
caster->Player->TotalRazings++;
|
||||
} else {
|
||||
caster->Player->TotalKills++;
|
||||
}
|
||||
#ifdef USE_HP_FOR_XP
|
||||
caster->XP += target->HP;
|
||||
caster->XP += target->HP;
|
||||
#else
|
||||
caster->XP += target->Type->Points;
|
||||
caster->XP += target->Type->Points;
|
||||
#endif
|
||||
caster->Kills++;
|
||||
caster->Kills++;
|
||||
}
|
||||
|
||||
// as said somewhere else -- no corpses :)
|
||||
RemoveUnit(target, NULL);
|
||||
UnitLost(target);
|
||||
UnitClearOrders(target);
|
||||
ReleaseUnit(target);
|
||||
if (UnitTypeCanMoveTo(x, y, type)) {
|
||||
UnitCacheRemove(target);
|
||||
canplace = 1;
|
||||
for (i = 0; i < type->TileWidth; ++i) {
|
||||
for (j = 0; j < type->TileHeight; ++j) {
|
||||
if (!UnitTypeCanMoveTo(x + i, y + j, type)) {
|
||||
canplace = 0;
|
||||
i = j = 10343243;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (canplace) {
|
||||
caster->Mana -= spell->ManaCost;
|
||||
MakeUnitAndPlace(x, y, type, Players + PlayerNumNeutral);
|
||||
UnitLost(target);
|
||||
UnitClearOrders(target);
|
||||
ReleaseUnit(target);
|
||||
if (spell->Missile) {
|
||||
MakeMissile(spell->Missile,
|
||||
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
|
||||
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
PlaceUnit(target, target->X, target->Y);
|
||||
return 0;
|
||||
}
|
||||
if (spell->Missile) {
|
||||
MakeMissile(spell->Missile,
|
||||
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
|
||||
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1154,8 +1177,9 @@ global int SpellCast(Unit* caster, const SpellType* spell, Unit* target,
|
|||
//
|
||||
// Ugly hack, CastAdjustVitals makes it's own mana calculation.
|
||||
//
|
||||
if (act->CastFunction!=CastAdjustVitals &&
|
||||
act->CastFunction!=CastSummon) {
|
||||
if (act->CastFunction != CastAdjustVitals &&
|
||||
act->CastFunction != CastPolymorph &&
|
||||
act->CastFunction != CastSummon) {
|
||||
caster->Mana -= spell->ManaCost;
|
||||
}
|
||||
PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
|
||||
|
|
|
@ -218,6 +218,7 @@ global void UnitCacheInsert(Unit* unit)
|
|||
for (j = 0; j < unit->Type->TileWidth; ++j) {
|
||||
mf = TheMap.Fields + (i + unit->Y) * TheMap.Width + j + unit->X;
|
||||
listitem = unit->CacheLinks + i * unit->Type->TileWidth + j;
|
||||
DebugCheck(listitem->Next || listitem->Prev);
|
||||
|
||||
// Always add at the start of the list.
|
||||
listitem->Next = mf->UnitCache;
|
||||
|
|
Loading…
Add table
Reference in a new issue