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

天行健 君子當自強而不息

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) 評論(0)  編輯 收藏 引用

公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            六月丁香综合| 欧美一级视频精品观看| 亚洲第一中文字幕在线观看| 久久国产精品72免费观看| 国产亚洲精品久久久| 久久青青草综合| 免费日韩视频| 亚洲在线视频| 欧美一区视频| 亚洲精品少妇| 亚洲一区二区日本| 一区精品在线| 亚洲精品一区二区三区四区高清| 国产精品久久久久久久久免费樱桃 | 欧美区一区二| 午夜在线成人av| 葵司免费一区二区三区四区五区| 99视频在线观看一区三区| 亚洲一区二区黄色| 亚洲国产精品视频一区| 99精品欧美一区二区三区综合在线| 欧美日韩视频专区在线播放| 久久久青草青青国产亚洲免观| 欧美成人午夜激情| 欧美一区二区三区久久精品茉莉花 | 久久精品一二三区| 一区二区三区精品国产| 欧美一区二区三区四区夜夜大片 | 亚洲精品在线免费观看视频| 亚洲色图在线视频| 91久久国产综合久久| 亚洲性感美女99在线| 亚洲国产欧美日韩| 欧美一区二区三区四区高清| 一区二区久久久久| 伊人成人在线| 亚洲视频狠狠| 亚洲免费高清| 另类成人小视频在线| 午夜精品久久久久久久男人的天堂 | 欧美视频一区二区三区在线观看| 久久最新视频| 国产一区av在线| 亚洲一区二区精品视频| 99天天综合性| 欧美激情一区二区三级高清视频| 久久久久久久国产| 国产精品男gay被猛男狂揉视频| 亚洲国产精品一区二区第一页| 国产一区欧美日韩| 欧美一区二区免费视频| 校园春色国产精品| 欧美天堂亚洲电影院在线观看 | 欧美成人一区二区三区在线观看| 国产目拍亚洲精品99久久精品| 艳女tv在线观看国产一区| 亚洲精品一区二区三区婷婷月 | 欧美中文字幕| 久久亚洲一区二区三区四区| 国产精品综合网站| 亚洲欧美日韩国产综合| 性亚洲最疯狂xxxx高清| 国产精品日韩电影| 亚洲丝袜av一区| 亚洲综合视频一区| 国产精一区二区三区| 午夜日韩av| 久久噜噜噜精品国产亚洲综合| 国产综合色产在线精品| 久久精品视频在线看| 男女激情久久| 日韩午夜电影av| 欧美日韩在线视频一区二区| 国产精品99久久久久久久女警| 亚洲综合另类| 狠狠色丁香婷婷综合| 久久午夜视频| 日韩午夜在线播放| 欧美在线观看视频一区二区| 国内精品久久久久久久影视麻豆| 久久国产综合精品| 亚洲电影第1页| 亚洲尤物在线视频观看| 国产午夜精品全部视频播放| 久久久精品网| 亚洲欧洲偷拍精品| 亚洲欧美制服中文字幕| 激情一区二区三区| 欧美劲爆第一页| 亚洲免费婷婷| 欧美黄免费看| 校园春色综合网| 亚洲国产欧美日韩| 国产精品久久777777毛茸茸| 久久久久国产一区二区三区| 亚洲黄色有码视频| 欧美一级片一区| 亚洲精品中文在线| 国产精品一区二区三区观看| 久久亚洲精品一区二区| 在线亚洲高清视频| 欧美xxxx在线观看| 亚洲综合精品一区二区| 亚洲日本无吗高清不卡| 国产欧美精品xxxx另类| 欧美黑人一区二区三区| 香港久久久电影| 日韩视频在线永久播放| 久久影院午夜论| 亚洲欧美国产精品桃花| 亚洲破处大片| 国产亚洲欧美日韩日本| 欧美日韩一区二区在线观看视频| 久久精精品视频| 亚洲视频专区在线| 亚洲精品久久嫩草网站秘色| 免费成人黄色片| 久久精品二区三区| 亚洲自拍电影| 亚洲无限av看| 日韩亚洲国产精品| 亚洲国产99精品国自产| 国产一区二区三区直播精品电影 | 久久精品国产精品亚洲综合| 亚洲午夜精品久久久久久浪潮 | 久久精品国产成人| 亚洲欧美日韩国产综合在线| 日韩一本二本av| 最新精品在线| 亚洲人成艺术| 亚洲欧洲三级| 亚洲精品一区二区三区蜜桃久 | 日韩视频在线一区| 亚洲国产精品女人久久久| 国内精品久久久久影院色 | 久久综合伊人77777蜜臀| 久久99在线观看| 久久国产乱子精品免费女 | 亚洲精选一区| 亚洲精选大片| 中文无字幕一区二区三区| 日韩一区二区精品| 一区二区三区免费在线观看| 999亚洲国产精| 一区二区三区高清视频在线观看| 99在线热播精品免费| 在线中文字幕一区| 亚洲视频在线观看三级| 亚洲一区在线观看免费观看电影高清| 在线视频一区二区| 亚洲永久免费观看| 欧美在线视频全部完| 久久天堂精品| 欧美日韩黄色大片| 国产精品高潮呻吟| 国产亚洲欧美一区二区三区| 在线日韩av片| 日韩午夜免费视频| 亚洲欧美国产不卡| 久久久亚洲精品一区二区三区| 美女视频黄免费的久久| 91久久久精品| 亚洲影音一区| 久久这里只有精品视频首页| 欧美国产日韩在线| 国产精品欧美日韩| 亚洲高清自拍| 亚洲一区日韩| 欧美v日韩v国产v| 夜夜爽99久久国产综合精品女不卡| 亚洲一区在线播放| 欧美va天堂| 国产欧美日韩另类一区| 亚洲欧洲日本国产| 欧美一区二区三区四区在线观看地址 | 麻豆国产精品va在线观看不卡| 亚洲国产高清aⅴ视频| 亚洲午夜一二三区视频| 久热精品在线视频| 国产精品日韩电影| 亚洲精品免费一二三区| 久久国产精品电影| 亚洲国产裸拍裸体视频在线观看乱了中文 | 久久综合色播五月| 国产精品日韩二区| 亚洲乱亚洲高清| 久久久久久一区| 99国产精品99久久久久久粉嫩| 欧美在线不卡| 欧美日韩精品系列| 亚洲国产欧美在线| 久久精品欧美日韩| 在线视频精品一| 欧美精品在线观看播放| 1000部精品久久久久久久久| 亚洲尤物视频在线| 亚洲精品久久7777| 蜜桃精品一区二区三区| 国内精品国产成人| 欧美在线一级视频|