• <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>

            天行健 君子當自強而不息

            Controlling Players and Characters(19)

             

            The Function of Spells
             

            The functional component of a spell does the real work. Once a spell runs through
            its animation and reaches its intended target, the damaging or beneficial effects
            need to be dealt with.

            Healing spells need to restore health to an injured character, whereas damaging
            spells need to take away health. In fact, just about any aspect of a character can be
            altered from a spell, ranging from characters’ health and mana to their abilities
            such as attack or defense. In Table 16.5, I define the effects that can be used as a
            spell effect.

            Each spell effect has a supporting value defined in the source code as an enum
            object that is defined as follows:

            enum SpellEffects {
              ALTER_HEALTH = 0,
              ALTER_MANA,
              CURE_AILMENT,
              CAUSE_AILMENT,
              RAISE_DEAD,
              INSTANT_KILL,
              DISPEL_MAGIC,
              TELEPORT
            };

            Each spell effect is assigned a number. In that way, you can contain the processing
            of a spell effect within a single switch statement, as in the following:

            switch(SpellEffect) {
              case ALTER_HEALTH:
                // do health altering processing
              case ALTER_MANA:
                // do mana alter processing
                ...
            }

            Each spell effect is pretty straightforward. Now, take a closer look at just what each
            of these effects do.

             

            Alter Health and Mana
             

            A spell can cause damage or rob characters of their stored mana, or it can, on the
            other hand, restore health or mana. Alteration of health is probably the most widely
            used spell effect.
             

            A health altering spell has an associated value that determines how much health is
            removed or added to the target character. The same applies to mana points, which
            can be restored or drained away with the mere flick of a wizard’s hand.

             

            Cure and Cause Ailment


            Status ailments are the bane and bonus of a character’s abilities and attributes. The
            duo of curing and causing spell effects gives you great freedom in devising how to
            curse or what to bestow upon a character.


            When you alter an ailment (cause or cure), you must use a bit-encoded number to
            define the ailment. By using bit flags, more than one status ailment can be caused
            or cured at once. Each ailment has an associated macro defined as follows:

            #define AILMENT_POISON 1
            #define AILMENT_SLEEP 2
            #define AILMENT_PARALYZE 4
            #define AILMENT_WEAK 8
            #define AILMENT_STRONG 16
            #define AILMENT_ENCHANTED 32
            #define AILMENT_BARRIER 64
            #define AILMENT_DUMBFOUNDED 128
            #define AILMENT_CLUMSY 256
            #define AILMENT_SUREFOOTED 512
            #define AILMENT_SLOW 1024
            #define AILMENT_FAST 2048
            #define AILMENT_BLIND 4096
            #define AILMENT_HAWKEYE 8192
            #define AILMENT_SILENCED 16384

            Character ailments are stored within a single 32-bit variable, and all characters have
            an ailment variable associated with them. That’s right, any character in your game
            can be burdened with status ailments, but it is harder to afflict characters that have
            a higher resistance.

             

            Raise Dead and Instant Kill


            At times, your poor characters are going to die, and except for MCs, you want the
            ability to raise them from the dead. The raise dead spell effect does just that—
            raises PC or NPC characters from death and gives them exactly one health point.


            On the flip side, there will be times when you just want to strike a monster down in
            one blow. That’s the purpose of the instance kill effect. Although having little
            chance of working, the instant kill ability is still a force to be reckoned with.

             

            Dispel Magic


            Forget all those status ailment-curing spells; why not just get rid of them all in one
            shot! The dispel effect clears a target character’s ailments, whether good or bad,
            and although this effect can be represented as a cure ailment effect, it becomes
            much easier to not use bit flags.

             

            Teleport


            Other than walking around, the best way to travel is to magically teleport around.
            Only PCs can use this spell. Teleporting can move a PC to any position on a map.


            posted on 2007-11-16 14:24 lovedday 閱讀(192) 評論(0)  編輯 收藏 引用

            公告

            導航

            統計

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關鏈接

            搜索

            最新評論

            丰满少妇高潮惨叫久久久| 亚洲综合久久综合激情久久 | 久久久久亚洲AV成人片| 久久久无码精品亚洲日韩蜜臀浪潮| 久久综合给合久久国产免费 | av午夜福利一片免费看久久| 久久国产精品波多野结衣AV| 日韩人妻无码精品久久免费一| 久久综合狠狠色综合伊人| 亚洲国产成人精品女人久久久 | 免费无码国产欧美久久18| 久久99热精品| 伊人久久精品无码av一区| 精品久久久久久无码中文野结衣 | 久久久久综合国产欧美一区二区| 欧美亚洲色综久久精品国产| 久久av高潮av无码av喷吹| 国内精品久久久久影院一蜜桃| 久久久WWW成人| 国内精品久久久久久久coent| 国产一级做a爰片久久毛片| 久久人与动人物a级毛片| 国产精品久久久久久久app | 久久综合给合久久国产免费| 亚洲精品无码久久久| 无码人妻久久一区二区三区免费丨| 久久天天躁狠狠躁夜夜躁2O2O| 四虎影视久久久免费| 久久精品国产亚洲网站| 久久精品蜜芽亚洲国产AV| 狠狠色丁香久久婷婷综合图片 | 久久综合九色综合精品| 久久婷婷五月综合97色| 亚洲AV乱码久久精品蜜桃| 久久笫一福利免费导航| 久久中文字幕视频、最近更新 | 久久久亚洲欧洲日产国码aⅴ | 久久综合狠狠综合久久激情 | 久久青草国产手机看片福利盒子| 成人久久久观看免费毛片| 久久精品国产91久久麻豆自制|