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

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

            Controlling Players and Characters(25)

             

            Determining Victims and Processing Spell Effects

            After a spell triggers and the effects are processed, what happens? As I’ve previously
            mentioned, spells only affect characters, so only the character controller engine
            should modify the character’s data. In the section “Creating a Character Controller
            Class,” later in this chapter, you find out how to process spells in regard to characters.

             

            Using the Spell Controller

            At this point, the spell controller is fully functional, but without the aid of the character
            controller, the spell controller won’t work. However, for the moment, hold
            that thought and observe the following example, which shows how to use the spell
            controller. Begin by instancing the spell controller and declaring an array of mesh
            filenames:

            // Graphics = pre-initialized cGraphics object
            // Use two meshes

            char *g_SpellMeshNames[] = {
              { “Fireball.x” },
              { “Explosion.x” }
            };

            Next, instance and initialize the spell controller:

            cSpellController Controller;

            // Initialize the controller
            Controller.Init(&Graphics, “default.msl”,
               sizeof(g_SpellMeshNames)/sizeof(char*), g_SpellMeshNames, “..\\”, NULL);

            Now you’re ready for action. Assuming that you have a single spell in the MSL
            (spell 0), you can cast it with the following code:

            Controller.Add(0, NULL, CHAR_MONSTER, 0.0f, 0.0f, 0.0f, 100.0f, 0.0f, 100.0f);

            The spell will now travel from the coordinates 0,0,0 to the coordinates
            100,0,100 using the settings specified in the MSL Editor. When you finish
            with the spell controller, always be sure to call the controller’s Shutdown function:

            Controller.Shutdown();

             

            Combat and Characters

            There are times when characters just can’t get along. For those special moments,
            you need to teach those critters just who the boss is. Handling combat in your
            game is a necessity that, fortunately, is easy to carry out.

            Although the flashy graphics and cool special effects are something you want in
            combat sequences, you need to start with the basics. Behind every combat action is
            a set of rules (called the combat rules) that determines the outcome of every swing
            of a weapon, every deflected blow, and the result of each magic spell.

            Earlier in the chapter, you learned about character abilities—those abilities that
            determine a character’s strength, agility, and so on. The abilities that most concern
            you at this point are those to determine whether an attack hits its mark and how
            much damage it does. Following a succinct set of rules, you can use those character
            abilities to determine the outcome of combat.

             

            Using Combat Rules for Attacking

            Your game depends greatly on a set of underlying rules for handling combat, much
            like traditional pen-and-paper role-playing games. Those rules are a set of mathematical
            equations, which, when applied with a little randomness, determine the
            outcome of attacks, damage, and defense.

            The combat rule set (CRS) of your game works off the character’s abilities, attributes,
            and skills that you’ve already seen in this chapter. Remember how those abilities,
            skills, and attributes are assigned a numerical value? Guess what? Those values are
            used to generate a few values that determine the outcome of combat actions.

            For example, a character’s to-hit attribute is used in a random number calculation
            to see whether an attack lands. Then a check against the agility of the attacker’s
            opponent determines whether the attack was dodged. If the opponent was not so
            lucky, the attacker’s attack values come into play to determine the damage.
            Remember that the character being hit also has a defense ability that helps reduce
            the amount of damage.

            Once the decision to attack is made, a few steps determine the outcome.


            posted on 2007-12-03 20:12 lovedday 閱讀(179) 評(píng)論(0)  編輯 收藏 引用


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


            公告

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            隨筆分類(178)

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

            搜索

            最新評(píng)論

            久久国产精品久久久| 国产精品欧美久久久久无广告| 久久亚洲精品国产精品婷婷| 久久婷婷色综合一区二区| 中文字幕久久波多野结衣av| 久久精品国产亚洲AV电影 | 一级a性色生活片久久无| 亚洲国产日韩欧美久久| 久久亚洲春色中文字幕久久久 | 无遮挡粉嫩小泬久久久久久久| 国产V亚洲V天堂无码久久久| 国内精品伊人久久久久网站| 精品无码久久久久国产动漫3d| 国产精品岛国久久久久| 国产99久久久国产精品小说| 久久99免费视频| 亚洲国产另类久久久精品黑人| 久久精品国产一区二区三区日韩| 亚洲国产日韩欧美久久| 精品久久香蕉国产线看观看亚洲| 亚洲国产成人久久综合碰| www性久久久com| 久久香蕉超碰97国产精品| 久久综合九色综合欧美就去吻| 97久久超碰国产精品旧版| 狠狠色丁香久久婷婷综合图片| 99久久人人爽亚洲精品美女| 国产精品久久精品| 久久久久成人精品无码中文字幕| 日韩久久无码免费毛片软件| 国产午夜精品久久久久九九电影| 久久99免费视频| 天天综合久久久网| 伊人色综合久久天天| 国产一级做a爰片久久毛片| 无码AV中文字幕久久专区| 亚洲欧美伊人久久综合一区二区 | 无夜精品久久久久久| 国内精品久久久久国产盗摄| 久久99精品九九九久久婷婷| 久久国产精品一区|