青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

Controlling Players and Characters(20)

 

Spell Targeting, Cost, and Chances


Spell effects usually target a single player, but this is not always the case. At times,
the spell is either targeted at the spell caster or all the characters within an area.
Also, not all characters can be affected by a spell. A spell cast by a monster, for
example, should not hurt other monsters, just PCs. In the same vein, spells cast
by PCs should be directed only toward monsters.

Each spell has a range of attack; that is, any target within this range can be targeted
by the spell. Once a spell is launched and takes effect, the spell has a specific distance
at which the effect extends outward from the impact point. A spell targeting multiple
characters can then affect those characters under the spell’s distance of effect.

Assuming that a character knows a spell (dictated by tracking a bit-encoded variable
for each character), you can determine how much mana is required to cast
the spell. Each spell has an associated cost assigned—a character must have that
much mana to cast the spell. Once cast, the spell’s cost in mana is deducted from
the casting character’s mana points.

Merely casting a spell doesn’t mean it will work, however; there are chances of failure.
The chance of the spell working or failing is called the spell effect chance, and
this chance ranges from 0 percent (never works) to 100 percent (always works).

 

The Master Spell List
 

Every aspect of a spell that you’ve read about can be stored within a single structure,
making it much easier to work with.

This structure, sSpell, is as follows:

typedef struct sSpell
{
    
char    name[32];
    
char    desc[128];
    
    
long    damage_class;   // class that spell does 2x damage
    long    cure_class;     // class that spell aids

    
long    cost;           // spell casting cost in mp

    
float   max_dist;       // max distance to target

    
long    effect;         // spell effect
    long    chance;         // percent of effect occurring
    float   value[4];       // misc values

    
long    target;         // target of spell
    float   range;          // range (in game units)

    
long    mesh_index[3];  // mesh index to use
    long    mesh_pos[3];    // positioning of mesh
    float   mesh_speed[3];  // speed of mesh movement
    long    mesh_sound[3];  // sound effect index to play
    BOOL    mesh_loop[3];   // loop animation
} *sSpellPtr;

As you can see, each spell is assigned a name and a description, both of which are
contained with small buffers. Your game engine will display the name of each spell
in anticipation of the player selecting one to cast when the time comes.

With spells, those classes come into effect. Certain spells can do double damage to characters that have a
weak defense against them, which is the reason for the sSpell::
damage_class variable.
If the character’s class and
damage_class variables match, the spell does double damage.

On the other hand, if a character’s class is based on the spell’s class, that spell actually
heals the character. Imagine casting an ice spell at an ice dragon. Instead of
hurting the dragon, it heals him for half the damage amount of the spell. Thus, the
purpose of sSpell::
cure_class; becomes apparent; if the character’s class and cure_class;
match, the spell heals rather than hurts.

Moving on, you can see the spell casting cost (sSpell::cost), measured in mana
points. A character must have at least this amount of mana (cost) in reserve to cast
the spell. Once the spell is cast, the value in the Cost variable is deducted from the
character’s mana.

Remember that spells have an assigned range and distance; range (sSpell::range) is
the distance away from the caster that a spell can reach and strike a target, whereas
distance (sSpell::
max_dist) is the parameter around the targeted position at which
the spell’s effects can take place.

Once a spell finds its mark, the cSpell::target variable determines who or what is
affected—either the spell caster, a single target caught in the parameter of the
spell, or all characters caught in the parameter. Each type of target is defined in
the engine as follows:

enum SpellTargets {
  TARGET_SINGLE = 0,
  TARGET_SELF,
  TARGET_AREA
};

The spell’s effect (sSpell::effect) has an associated chance of success, which is
stored in sSpell::chance. Each value has an associated trio of variables (sSpell::value)
at its disposal. The first value in the array is the amount of damage caused or cured
or the bit values of the ailment to be used.

The values’ only other use is for the teleport spell effect; for NPCs and monsters,
the first three values are those of the coordinates inside the current level that the
character is moved to whenever the teleport spell is cast. As for PCs, the fourth
variable is used to specify which map the player will be switched to when the spell
is cast. Because of the complexity of teleporting PCs, let the game script engine
handle such teleporting situations.

You use the final group of variables (mesh_index, mesh_pos, mesh_speed, mesh_sound, and
mesh_loop) for the graphical portion of the spell. Rather than reference the spell
meshes by name, it is much more efficient to use numbers. The
mesh_indexstores a
mesh number that the spell control engine uses for drawing the spell’s graphics.

mesh_posis the array of variables that contains the position of each mesh. Remember
that a mesh can hover over the caster or target, move to or from them, and even
stretch out between the two characters. You can set the
mesh_pos variables to one of
the following values:

enum AnimPositions {
  POSITION_NONE = 0,
  POSITION_CASTER,
  POSITION_TOTARGET,
  POSITION_TOCASTER,
  POSITION_TARGET,
  POSITION_SCALE
};

Again, each mesh has an associated speed of travel or time that it remains in place
(as it hovers over a character or stretches out between two positions). Both speed
and time are stored in the
mesh_speed variable, as only one of those values is used
(depending on the movement of the mesh).

In speed calculations, mesh_speed determines the distance in 3-D units that the mesh
travels in one second. For time, the
mesh_speed variable is converted into a long value
that represents the amount in milliseconds that the mesh remains in place.

If the mesh is able to complete its animation cycle before it reaches its target or
before its time of display is up, the mesh_loop variables tell the spell control engine to
loop the animation over and over until the mesh cycle is complete.

As a final bonus, each one of the three meshes has the ability to emanate a sound
when the mesh is initialized (positioned). Imagine that your fireball spell is sizzling
toward its target, only to blast forth in a speaker-shattering sound! You also reference
each sound by a number and have your game engine play those sounds.

 

The Spell List


You use an array of sSpell structures to contain the information about every spell in
a game. This array of structures is called the master spell list (referred to as MSL from
now on), which is stored as a sequential data file. The spell data structure is relatively
small, which means that the list can be completely loaded at the start of the
game in order to save you time when accessing the data.

Looking back, you can see I’ve designated that each character has the ability to use
64 spells, so the MSL should hold only 64 sSpell data structures, each representing
a single spell that is available for use by all characters.

As I mentioned previously, it becomes a matter of loading each sSpell structure
with the appropriate spell data needed. Even with only 64 spells at your disposal,
trying to hard-code that many spell structures is too much work.


posted on 2007-11-16 17:18 lovedday 閱讀(224) 評(píng)論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久夜色精品一区| 99亚洲一区二区| 久久精品人人爽| 激情久久久久| 欧美国产日韩一区| 欧美成在线观看| av成人黄色| 亚洲一区二区精品在线观看| 国产视频在线观看一区| 久久久亚洲午夜电影| 噜噜噜久久亚洲精品国产品小说| 亚洲精品免费一二三区| 一区二区三区国产在线| 国产视频欧美| 亚洲国产福利在线| 欧美性猛交视频| 久久久久久999| 欧美激情四色| 欧美综合国产| 欧美成人免费视频| 欧美在线中文字幕| 欧美第一黄色网| 欧美亚洲尤物久久| 欧美高清自拍一区| 久久成人免费视频| 欧美精品18+| 久久久久久久久一区二区| 欧美高清视频www夜色资源网| 新67194成人永久网站| 美女日韩在线中文字幕| 欧美一区二区在线观看| 欧美大片在线看免费观看| 欧美一区二区观看视频| 男女精品视频| 久久精品论坛| 国产精品初高中精品久久| 欧美激情1区2区3区| 国产欧美一区二区三区国产幕精品| 欧美二区在线观看| 国产自产女人91一区在线观看| 亚洲精品久久久久久久久久久久久 | 欧美成人久久| 国产日韩欧美一区二区| 夜夜夜久久久| 亚洲精品综合| 久久一区欧美| 久久精品亚洲一区二区| 国产精品理论片| 亚洲国产精品久久久| 尤物九九久久国产精品的特点 | 香蕉久久精品日日躁夜夜躁| 亚洲视频综合| 欧美日本一区二区高清播放视频| 免费在线观看精品| 国内精品久久久| 精品成人一区| 久久久亚洲综合| 国产亚洲综合精品| 欧美一区二区三区啪啪| 亚洲欧美一级二级三级| 久久乐国产精品| 久久蜜桃资源一区二区老牛| 久久亚洲综合色一区二区三区| 国产精品xnxxcom| 一区二区电影免费观看| 亚洲一区综合| 国产精品免费aⅴ片在线观看| 一区二区三区日韩欧美| 亚洲欧美日韩在线高清直播| 国产精品嫩草影院一区二区| 亚洲视频在线观看一区| 欧美一区二区三区免费观看视频| 国产免费观看久久| 久久不射网站| 欧美刺激午夜性久久久久久久| 亚洲国产国产亚洲一二三| 老司机一区二区三区| 一区二区日韩伦理片| 美女在线一区二区| 欧美黄色一级视频| 9人人澡人人爽人人精品| 亚洲一区三区视频在线观看| 国产精品毛片一区二区三区| 久久国内精品视频| 亚洲动漫精品| 亚洲一区二区不卡免费| 国产欧美日韩一区二区三区在线观看| 性欧美18~19sex高清播放| 久久久久久自在自线| 亚洲国产另类精品专区 | 久久激情五月激情| 亚洲激情网站免费观看| 亚洲午夜国产一区99re久久 | 欧美激情小视频| 一区二区三欧美| 久久午夜精品| 亚洲特色特黄| 极品少妇一区二区| 欧美麻豆久久久久久中文| 亚洲欧美韩国| 欧美激情亚洲一区| 欧美伊人久久| 亚洲精品免费一区二区三区| 国产欧美日韩麻豆91| 欧美黄色小视频| 久久激情久久| 亚洲性图久久| 亚洲国产日韩在线| 久久激情久久| 在线视频日本亚洲性| 在线成人中文字幕| 国产老女人精品毛片久久| 欧美电影免费观看大全| 欧美专区中文字幕| 亚洲一区日韩| 亚洲免费观看| 欧美激情在线免费观看| 久久人人97超碰精品888| 亚洲欧美视频在线观看视频| 999亚洲国产精| 亚洲国产精品久久久久久女王| 国产精品一区二区久久久久| 欧美日韩第一页| 蜜桃av噜噜一区| 久久久久这里只有精品| 香港成人在线视频| 亚洲一本视频| 一区二区三区视频在线| 99视频+国产日韩欧美| 亚洲高清视频一区| 欧美激情一区二区三区全黄 | 免费看的黄色欧美网站| 久久久99国产精品免费| 欧美综合国产| 欧美诱惑福利视频| 欧美一区二区在线播放| 欧美在线国产精品| 欧美一二三区在线观看| 欧美一级欧美一级在线播放| 亚洲欧美另类久久久精品2019| 亚洲一区二区三区三| 亚洲视频你懂的| 亚洲天天影视| 性欧美18~19sex高清播放| 午夜精品一区二区三区四区| 亚洲一区二区三区在线看| 亚洲影院高清在线| 亚洲女人小视频在线观看| 亚洲永久精品大片| 校园春色国产精品| 久久久久久久尹人综合网亚洲| 欧美在线视频观看免费网站| 久久精品一级爱片| 女同性一区二区三区人了人一| 老巨人导航500精品| 欧美激情一区二区三区成人| 亚洲国产精品免费| 日韩一级免费观看| 亚洲永久精品国产| 久久精品二区三区| 欧美1区免费| 欧美日韩国产一级| 国产欧美精品国产国产专区| 精品成人一区二区| 日韩一级黄色片| 亚洲一区二区在线免费观看视频| 欧美一区日本一区韩国一区| 久久久久综合网| 亚洲高清视频一区| 亚洲欧美在线免费| 久久一区二区三区超碰国产精品| 欧美国产日本| 国产精品影音先锋| 亚洲精品久久久久久久久久久久久 | 久久国产精品一区二区三区| 老鸭窝91久久精品色噜噜导演| 欧美美女操人视频| 国产日韩综合| 亚洲精选视频在线| 久久精品一区蜜桃臀影院| 亚洲二区在线| 亚洲女性喷水在线观看一区| 免费高清在线一区| 国产精品无码专区在线观看| 在线观看欧美| 午夜欧美大尺度福利影院在线看| 欧美成人激情视频| 亚洲一区二区三| 欧美国产丝袜视频| 国产一区二区在线观看免费| 中文精品视频| 欧美国产在线观看| 欧美一区二区三区播放老司机| 欧美精品免费观看二区| 一区二区自拍| 久久爱www| 亚洲午夜av电影| 欧美搞黄网站| 亚洲第一福利视频| 久久久7777|