当前位置: 首页>>代码示例>>C#>>正文


C# Actions.Get_Damage方法代码示例

本文整理汇总了C#中Actions.Get_Damage方法的典型用法代码示例。如果您正苦于以下问题:C# Actions.Get_Damage方法的具体用法?C# Actions.Get_Damage怎么用?C# Actions.Get_Damage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions.Get_Damage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Do_Area_Effect

    public void Do_Area_Effect(List<Vector3> squares, Characters attacker, Actions act)
    {
        GameObject instance;
        instance = Instantiate(effects[1], act._area_start, Quaternion.identity) as GameObject;
        instance.transform.SetParent(effectholder);
        Vector3 dir = (act._area_target - act._area_start);
        dir.Normalize ();
        float ang = Vector3.Angle (new Vector3(1,0,0), dir);
        if (dir.y < 0)
            ang *= -1;
        instance.transform.Translate (dir/2);
        instance.transform.Rotate ( new Vector3 (0, 0, ang) );
        effecttime = 30;

        // write log
        Append_Log (attacker.charname + " uses " + act._name);

        // roll damage
        int dmg = Dice.roll (act.Get_Damage());

        disp_dmgpos.Clear();
        disp_dmgstr.Clear();

        // Get affected target
        foreach (Vector3 pos in squares) {
            int target = map.Get_Char_At (pos);
            if (target>0){

                int sv =characters[target].Roll_Save (act._save_type);
                int dd = sv < act._save_dc ? dmg : dmg/2;

                disp_dmgpos.Add(pos);
                disp_dmgstr.Add (dd.ToString());
                // "Char rolls reflex save (20). Pass! Take 10 damage!"
                string passfail=sv < act._save_dc ? "Fail" : "Pass";
                Append_Log(characters[target].charname + " rolls " + Parser.Get_Save_Name(act._save_type) + " save ("
                           + sv + "). " + passfail + "! Takes " + dd + " damage!");
            }
        }

        showdmg = _dmgshowtime + effecttime;
    }
开发者ID:g5v991x,项目名称:testpf,代码行数:42,代码来源:GameMaster.cs

示例2: Do_Attack

    /// <summary>
    /// Perform an attack action
    /// </summary>
    /// <param name="pos">Position of the attack target</param>
    /// <param name="attacker">The attacker</param>
    /// <param name="act">Action used for this attack</param>
    public void Do_Attack(Vector3 pos, Characters attacker, Actions act)
    {
        int roll = Dice.roll ("1d20");
        bool iscrit = false;
        if (roll >= act._atk_crit_num) {
            iscrit=true;
        }
        int atk = roll + act._atk_bonus;
        string dmg_str = act.Get_Damage (iscrit);
        int dmg = Dice.roll(dmg_str);

        // Get attack target
        int target = map.Get_Char_At(pos);

        // " A attack B with weapon, roll (1d20 + N) = M "
        string log = attacker.charname + " attack " + characters[target].charname + " with " + act._name;
        log += ", roll 1d20 (" + roll + ") +" + act._atk_bonus + " = " + atk;

        Append_Log (log);
        log = " ";

        // A natural 20 always hit, and 1 always miss
        if (roll == 20)
            atk = 1000;
        else if (roll == 1)
            atk = -1000;

        // Check hit and damage
        int? dmgtaken = characters[target].Get_Hit(atk, dmg);
        disp_dmgpos.Clear();
        disp_dmgstr.Clear();

        disp_dmgpos.Add(pos);
        if (dmgtaken == null)
        {
            log += " Miss!";
            disp_dmgstr.Add("Miss");
        }
        else
        {
            disp_dmgstr.Add(dmgtaken.ToString());
            if (iscrit) log+=" Crit!!";
            else log+=" Hit!";
            log += " Deal " + dmg_str + " = " + dmgtaken + " damage.";
        }
        showdmg = _dmgshowtime;

        Show_effect(new Vector3(pos.x, pos.y, 0), 0,_dmgshowtime);
        Append_Log(log);
    }
开发者ID:g5v991x,项目名称:testpf,代码行数:56,代码来源:GameMaster.cs


注:本文中的Actions.Get_Damage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。