예제 #1
0
 /// <summary>
 /// 计算宠物伤害
 /// </summary>
 protected int PetDamage(NDAttribute TargetAttr)
 {
     if (TargetAttr == null || m_Attr == null)
     {
         return(0);
     }
     if (m_Attr.PetAttackType == 1)            //物理攻击
     {
         return(ScriptM.Formula <int>("CALC_SOLDIER_PHYDAMAGE",
                                      1,
                                      m_Attr.PhyAttack,
                                      m_Attr.CutPhyDefend,
                                      TargetAttr.PhyDefend,
                                      TargetAttr.CutPhyDamage,
                                      0));
     }
     else if (m_Attr.PetAttackType == 2)         // 魔法攻击
     {
         return(ScriptM.Formula <int>("CALC_SOLDIER_MAGICDAMAGE",
                                      1,
                                      m_Attr.MagicAttack,
                                      m_Attr.CutMagDefend,
                                      TargetAttr.MagicDefend,
                                      TargetAttr.CutMagDamage,
                                      0));
     }
     else if (m_Attr.PetAttackType == 3)         // 神圣技能
     {
         return(m_Attr.PetDamage);
     }
     else
     {
         return(0);
     }
 }
예제 #2
0
    public void PathAI(MapGrid start, MapGrid end, NDAttribute Attr, bool CutPath = false)
    {
        Path.PathAI(m_SceneID, start, end, RoleParent.m_Attr, CurrentGS, WalkDIR);
        if (CutPath)
        {
#if UNITY_EDITOR_LOG
            FileLog.write(RoleParent.SceneID, "PathAI");
#endif
            Life target = RoleParent.RoleWalk.m_RadarAI.GetTarget(Path, Attr.AttackLike);
            if (RoleParent.CheckTarget(target))
            {
                RoleParent.ChangeTarget(ChangeTargetReason.InGoldPath, target);
            }
            else
            {
                /*target = RoleParent.RoleWalk.GetAttacklikeTarget();
                 * Path.PathAI(m_SceneID,start,target.GetTargetMapGrid(),Attr,CurrentGS,WalkDIR);*/
            }
            //r.Target =  r.RoleWalk.m_RadarAI.GetTarget(Path,Attr.AttackLike);
        }

        if (!CheackIdlePath())
        {
            PathInit();
        }


        FirstCheckAttack();
    }
예제 #3
0
    public void PathAI(MapGrid start, MapGrid end, NDAttribute Attr)
    {
        Path.PathAI(m_SceneID, start, end, m_parent.m_Attr, CurrentGS, WalkDIR);

        //CheackIdlePath();
        //判断首个节点是否为楼梯
        PathData Road = Path.GetPathData(PathAccess.Cur);

        if (Road != null && Road.state == RoleState.STAIR)
        {
            m_Reject = true;
        }

        //获取路线上的下一个攻击位,包含当前路径点
        ErrorInfo Error             = new ErrorInfo();
        PathData  NextAttackStation = Path.GetNextAttackPosCurInPath(ref Error);

        if (NextAttackStation != null)
        {
            m_AttackStation  = NextAttackStation.Road.GridPos;
            m_NAttackStation = NextAttackStation.Road.GridPos;
        }

        //FirstCheckAttack();
    }
예제 #4
0
    public void PathAI(int SceneID, MapGrid start, MapGrid end, NDAttribute Attr, GridSpace gs, WalkDir dir)
    {
        m_SceneID = SceneID;
        if (Attr == null)
        {
            Debug.LogError("Attr == null");
            return;
        }
                #if UNITY_EDITOR_LOG
        FileLog.write(SceneID, "PathAI :" + start.GridPos + "," + end.GridPos);
                #endif
        AIPathData.SetPathParam(SceneID, Attr.Speed, Attr.JumpDistance, Attr.IsHandstand, Attr.IsKeepDir);
        AIPathData.SearchPath(start, end, ref m_SearchPath, gs, dir);
        //m_Index = 0;

                #if UNITY_EDITOR_LOG
        //打印整合路径
        if (PathCount > 0)
        {
            string str = SceneID + ",";
            for (int i = 0; i < SearchPath.Count; i++)
            {
                str += "{" + SearchPath[i].state + "," + SearchPath[i].Road.GridPos + "," + SearchPath[i].deltaTime + "," + SearchPath[i].dir + "," + SearchPath[i].gs + "},";
            }
            FileLog.write(SceneID, str, true);
        }
       #endif
    }
예제 #5
0
    /// <summary>
    /// 计算技能治疗量
    /// </summary>
    protected int CalcSkillRegenHP(NDAttribute Attack, NDAttribute Defense, ref AttackResult Result, SkillInfo skill)
    {
        //计算伤害
        int Damage = SkillRegenHP(Attack, Defense, skill);

        return(Damage);
    }
예제 #6
0
    public void GetAttrData(NDAttribute RoleAttr, LifeMCore Core)
    {
        if (RoleAttr == null)
        {
            return;
        }

        PetInfo Info = CmCarbon.GetPetInfo(Core);

        m_AttrType      = Info.m_type;
        m_speed         = RoleAttr.Speed * Info.m_speedpercent * 0.01f;
        m_jumpDistance  = (int)(RoleAttr.JumpDistance * Info.m_jumppercent * 0.01f);
        m_Hp            = (int)(RoleAttr.Hp * Info.m_hppercent * 0.01f);
        m_FullHp        = m_Hp;
        m_phy_attack    = (int)(RoleAttr.PhyAttack * Info.m_phyattackpercent * 0.01f);
        m_phy_defend    = (int)(RoleAttr.PhyDefend * Info.m_phydefendpercent * 0.01f);
        m_phy_crit      = (int)(RoleAttr.PhyCrit * Info.m_phy_critpercent * 0.01f);
        m_magic_attack  = (int)(RoleAttr.MagicAttack * Info.m_magicattackpercent * 0.01f);
        m_magic_defend  = (int)(RoleAttr.MagicDefend * Info.m_phydefendpercent * 0.01f);
        m_magic_crit    = (int)(RoleAttr.MagicCrit * Info.m_magic_critpercent * 0.01f);
        m_PetAttackType = Info.m_attacktype;
        m_PetDamage     = Info.m_damage;
        m_Anger         = Info.m_mp;
        m_FullAnger     = 1000;

        m_TargetImmune = (ImmuneTarget)Info.m_isattack;
        //出生产生的状态
        m_SelfStatus = Info.m_status;
    }
예제 #7
0
파일: Life.cs 프로젝트: 741645596/batgame
    /// <summary>
    /// 能否作为攻击目标
    /// </summary>
    /// <param name="Target">返回撞击信息</param>
    /// <returns>true 可以做为攻击目标,false 不能做为攻击目标</returns>
    public bool CanAttackTarget(Life Target)
    {
        if (Target == null || Target.m_Attr == null)
        {
            return(false);
        }
        if (m_Core == null)
        {
            return(false);
        }

        if (m_Core.m_type == LifeMType.SOLDIER)
        {
            return(!NDAttribute.CheckTargetImmune(ImmuneTarget.Soldier, Target.m_Attr.TargetImmune));
        }
        else if (m_Core.m_type == LifeMType.BUILD)
        {
            return(!NDAttribute.CheckTargetImmune(ImmuneTarget.Build, Target.m_Attr.TargetImmune));
        }
        else if (m_Core.m_type == LifeMType.PET)
        {
            return(!NDAttribute.CheckTargetImmune(ImmuneTarget.Pet, Target.m_Attr.TargetImmune));
        }
        else
        {
            return(false);
        }
    }
예제 #8
0
    protected int CalcDistanInfo(NDAttribute attrAttacter, NDAttribute attrDefence, int damage)
    {
        int   diffLevel   = attrAttacter.Level - attrDefence.Level;
        float factorStar  = 0;
        float factorLevel = 0;

        SkillM.GetDistainFactor(diffLevel, ref factorStar, ref factorLevel);
        return(ScriptM.Formula <int>("CALC_DISTAIN_DAMAGE", damage, factorLevel, factorStar));
    }
예제 #9
0
    /// <summary>
    /// 获取满血
    /// </summary>
    protected override int GetFullHp()
    {
        NDAttribute roomattr = GetRoomAttr();

        if (roomattr != null)
        {
            return(roomattr.FullHp);
        }
        return(m_FullHp);
    }
예제 #10
0
    public override int GetCurBear()
    {
        NDAttribute roomattr = GetRoomAttr();

        if (roomattr != null)
        {
            return(roomattr.CurBear);
        }
        return(0);
    }
예제 #11
0
    /// <summary>
    /// 计算技能伤害
    /// </summary>
    protected int SkillDamage(NDAttribute Attack, NDAttribute Defense, SkillInfo skill)
    {
        if (Attack == null || Defense == null || skill == null)
        {
            return(0);
        }
        AttackType Type   = (AttackType)skill.m_attacktype;
        int        power1 = skill.m_power1;
        int        power2 = skill.m_power2;

        if (Type == AttackType.Physical)    //物理攻击
        {
            return(ScriptM.Formula <int>("CALC_SOLDIER_PHYDAMAGE",
                                         power1,
                                         Attack.PhyAttack,
                                         Attack.CutPhyDefend,
                                         Defense.PhyDefend,
                                         Defense.CutPhyDamage,
                                         power2));
        }
        else if (Type == AttackType.Magic)      // 魔法攻击
        {
            return(ScriptM.Formula <int>("CALC_SOLDIER_MAGICDAMAGE",
                                         power1,
                                         Attack.MagicAttack,
                                         Attack.CutMagDefend,
                                         Defense.MagicDefend,
                                         Defense.CutMagDamage,
                                         power2));
        }
        else if (Type == AttackType.Sacred)      // 神圣技能
        {
            return(power2);
        }
        else if (Type == AttackType.Passive)     //被动技能
        {
            return(0);
        }
        else if (Type == AttackType.Fire)     //炮战技能
        {
            return(power2);
        }
        else
        {
            Debug.Log("不存在的仅能作用类型:" + skill.m_attacktype);
            return(0);
        }
    }   /// <summary>
예제 #12
0
    /// <summary>
    /// 计算具有属性的技能的攻击伤害值
    /// </summary>
    ///
    public static int CalcAttributableSkillDamage(AttributeType attributeType, NDAttribute attrDefence, int damage)
    {
        if (attributeType == AttributeType.NONE)
        {
            return(damage);
        }

        int resistance = 0;     // 抗性
        int reduction  = 0;     // 减免
        int attack     = 0;     // 属性攻击

        if ((attributeType & AttributeType.Fire) == AttributeType.Fire)
        {
            resistance = attrDefence.GetAttrData(EffectType.AntiFire);
            attack     = attrDefence.GetAttrData(EffectType.FireAttack);
            reduction  = attrDefence.GetAttrData(EffectType.FireDamageReduction);
        }
        else if ((attributeType & AttributeType.Poison) == AttributeType.Poison)
        {
            resistance = attrDefence.GetAttrData(EffectType.AntiPotion);
            attack     = attrDefence.GetAttrData(EffectType.PotionAttack);
            reduction  = attrDefence.GetAttrData(EffectType.PotionDamageReduction);
        }
        else if ((attributeType & AttributeType.Water) == AttributeType.Water)
        {
            resistance = attrDefence.GetAttrData(EffectType.AntiWater);
            attack     = attrDefence.GetAttrData(EffectType.WaterAttack);
            reduction  = attrDefence.GetAttrData(EffectType.WaterDamageReduction);
        }
        else if ((attributeType & AttributeType.Gas) == AttributeType.Gas)
        {
            resistance = attrDefence.GetAttrData(EffectType.AntiGas);
            attack     = attrDefence.GetAttrData(EffectType.GasAttack);
            reduction  = attrDefence.GetAttrData(EffectType.GasDamageReduction);
        }
        else if ((attributeType & AttributeType.Electric) == AttributeType.Electric)
        {
            resistance = attrDefence.GetAttrData(EffectType.AntiElectric);
            attack     = attrDefence.GetAttrData(EffectType.ElectricAttack);
            reduction  = attrDefence.GetAttrData(EffectType.ElectricDamageReduction);
        }

        return(ScriptM.Formula <int>("CALC_ATTRIBUTABLE_SKILL_DAMAGE",
                                     damage,
                                     attack,
                                     resistance,
                                     reduction));
    }
예제 #13
0
    public StationsInfo(NDAttribute Attr, int StaionsDeep, LifeMCamp Camp, DIR dir, GridSpace gs)
    {
        if (Attr != null)
        {
            m_IsHide     = Attr.IsHide;
            m_Passageway = Attr.Passageway;
            m_Shape      = Attr.Shape;
            m_Speed      = Attr.Speed;
        }
        else
        {
            Debug.LogError("Attr is null ");
        }

        this.m_StaionsDeep = StaionsDeep;
        this.m_Camp        = Camp;
        this.m_dir         = dir;
        this.m_InPutTime   = Time.realtimeSinceStartup;
        this.m_GridSpace   = gs;
    }
예제 #14
0
    /// <summary>
    /// 计算技能伤害
    /// </summary>
    protected int CalcSkillDamage(NDAttribute Attack, NDAttribute Defense, ref AttackResult Result, SkillInfo skill)
    {
        //未命中
        if (SkillHit(Attack, Defense, skill) == false)
        {
            Result = AttackResult.Miss;
            return(0);
        }

        //计算伤害
        int Damage = SkillDamage(Attack, Defense, skill);

        //是否暴击
        if (SkillCrit(Attack, Defense, skill) == true)
        {
            Result = AttackResult.Crit;
            Damage = SkillCritDamage(Damage, Attack.PhysicalCritBonusDamage, Attack.MagicCritBonusDamage, skill);
        }
        return(Damage);
    }
예제 #15
0
    }   /// <summary>

    /// 计算技能治疗量
    /// </summary>
    protected int SkillRegenHP(NDAttribute Attack, NDAttribute Defense, SkillInfo skill)
    {
        if (Attack == null || Defense == null || skill == null)
        {
            return(0);
        }
        AttackType Type   = (AttackType)skill.m_attacktype;
        int        power3 = skill.m_power3;
        int        power4 = skill.m_power4;
        int        cout   = 1;

        if ((skill as SoldierSkill).m_timeinterval > 0)
        {
            cout = (skill as SoldierSkill).m_step_secs / (skill as SoldierSkill).m_timeinterval;
        }
        return(ScriptM.Formula <int>("CACL_GENGEN_HP",
                                     Attack.MagicAttack,
                                     power3,
                                     power4,
                                     cout,
                                     Attack.AddDoctor));
    }
예제 #16
0
    /// <summary>
    /// 状态产生判断
    /// </summary>
    private bool CheckCondition(NDAttribute attr, SkillStatusInfo StatusInfo)
    {
        if (attr == null || StatusInfo == null)
        {
            return(false);
        }
        //为0 直接产生状态。
        EffectType s = (EffectType)StatusInfo.m_condition;

        if (s == EffectType.None)
        {
            return(true);
        }
        int data0 = StatusInfo.m_data0;
        int data1 = StatusInfo.m_data1;
        int value = attr.GetAttrData(s);

        if (value > data0 && value <= data1)
        {
            return(true);
        }
        return(false);
    }
예제 #17
0
 // 计算吸血回复生命值
 protected int CalcVampireHP(NDAttribute Attack, int damage)
 {
     return(ScriptM.Formula <int>("CACL_VAMPIRE_HP", Attack.Vampire, damage));
 }
예제 #18
0
 protected override bool SkillHit(NDAttribute Attack, NDAttribute Defense, SkillInfo skill)
 {
     return(true);
 }
예제 #19
0
 /// <summary>
 /// 技能暴击判断
 /// </summary>
 protected virtual bool SkillCrit(NDAttribute Attack, NDAttribute Defense, SkillInfo skill)
 {
     return(false);
 }
예제 #20
0
 /// <summary>
 /// 技能命中判断
 /// </summary>
 protected virtual bool SkillHit(NDAttribute Attack, NDAttribute Defense, SkillInfo skill)
 {
     return(true);
 }