Exemplo n.º 1
0
 public void Reset(BuffData _this,
                   uint id,
                   int dataid,
                   int bufflevel,
                   ObjCharacter caster,
                   BuffRecord tbbuff,
                   ObjCharacter bear,
                   eHitType hitType,
                   float fBili)
 {
     _this.mId       = id;
     _this.m_nBuffId = dataid;
     _this.m_nLevel  = bufflevel;
     SetCaster(_this, caster);
     _this.m_fDuration    = (float)tbbuff.Duration / 1000;
     _this.m_Bear         = bear;
     _this.m_nLayer       = 1;
     _this.m_nHuchi       = tbbuff.HuchiId;
     _this.m_HitType      = hitType;
     _this.m_fModify      = fBili;
     _this.m_bActive      = true;
     _this.m_nUpdataCount = 0;
     _this.m_Flag.CleanFlag(0);
     _this.mCoolDownTime = DateTime.MinValue;
     _this.RemainAbsorbDict.Clear();
     for (var i = 0; i < tbbuff.effectid.Length; ++i)
     {
         var effectId  = tbbuff.effectid[i];
         var absorbMax = tbbuff.effectparam[i, 2];
         if (effectId == (int)eEffectType.AbsorbInjury && absorbMax > 0)
         {
             _this.RemainAbsorbDict[(byte)i] = absorbMax;
         }
     }
 }
Exemplo n.º 2
0
        //增加buff
        public BuffData AddBuff(BuffList _this,
                                int buffId,
                                int bufflevel,
                                ObjCharacter caster,
                                ObjCharacter bear,
                                float fBili,
                                eHitType hitType)
        {
#if DEBUG
            if (caster is ObjPlayer)
            {
                Logger.Info("id={0}给{1}释放了{2}的Buff", caster.ObjId, bear.ObjId, buffId);
            }
#endif
            var tbbuff = Table.GetBuff(buffId);

            var buff = ObjectPool <BuffData> .NewObject();

            //var buff = ObjectPool<BuffData>.NewObject();
            buff.mBuff = caster.Skill.ModifyBuff(tbbuff, bufflevel);
            buff.Reset(GetNextUniqueId(_this), buffId, bufflevel, caster, buff.mBuff, bear, hitType, fBili);
            //mBuff = tbbuff,
            buff.Init();
            _this.mData.Add(buff);
            _this.mObj.MarkDbDirty();
            return(buff);
        }
Exemplo n.º 3
0
    private void _GenerateSkillImpl(StreamWriter sw, int skillId, string anim, eHitType hitType, int animLen)
    {
        string str = "skill(" + skillId.ToString() + ")";

        sw.WriteLine(str);
        sw.WriteLine("{");
        sw.WriteLine("\tsection(" + animLen.ToString() + ")");
        sw.WriteLine("\t{");

        str  = "\t\t";
        str += "animation(\"";
        str += anim;
        str += "\");";
        sw.WriteLine(str);

        str  = "\t\t";
        str += "areadamage(285, 0, 1.7, 1, 2.3, true)";
        sw.WriteLine(str);
        sw.WriteLine("\t\t{");
        if (hitType == eHitType.普通受击)
        {
            sw.WriteLine("\t\t\tstateimpact(\"kDefault\", 16000101);");
        }
        else
        {
            sw.WriteLine("\t\t\tstateimpact(\"kDefault\", 16020101);");
        }
        sw.WriteLine("\t\t};");

        sw.WriteLine("\t};");
        sw.WriteLine("};");
    }
Exemplo n.º 4
0
 //增加buff
 public BuffData AddBuff(int buffId,
                         int bufflevel,
                         ObjCharacter caster,
                         ObjCharacter bear,
                         float fBili,
                         eHitType hitType)
 {
     return(mImpl.AddBuff(this, buffId, bufflevel, caster, bear, fBili, hitType));
 }
Exemplo n.º 5
0
 public void Reset(uint id,
                   int dataid,
                   int bufflevel,
                   ObjCharacter caster,
                   BuffRecord tbbuff,
                   ObjCharacter bear,
                   eHitType hitType,
                   float fBili)
 {
     mImpl.Reset(this, id, dataid, bufflevel, caster, tbbuff, bear, hitType, fBili);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 初始化攻击对象
 /// </summary>
 public void Init(SkillActive skill, RoleActor target)
 {
     mSkill    = skill;
     mTarget   = target;
     mOwner    = skill.Owner;
     mKilled   = false;
     mHitType  = eHitType.Hit;
     mDamageHP = 0;
     mDamageMP = 0;
     mHatred   = 0;
 }
Exemplo n.º 7
0
    private void _GenerateSkillFile(int skillId, string anim, eHitType hitType, int animLen, bool bNormalAttack)
    {
        if (animLen == 0)
        {
            UnityEditor.EditorUtility.DisplayDialog("SkillEdit", "请检查技能动画长度,不能为0!", "OK");
            return;
        }

        const string skillfilePrefix = "Assets\\StreamingAssets\\Public\\SkillDsl\\";

        ArkCrossEngine.SkillLogicData skillData = (ArkCrossEngine.SkillLogicData)ArkCrossEngine.SkillConfigProvider.Instance.ExtractData(ArkCrossEngine.SkillConfigType.SCT_SKILL, skillId);
        if (skillData != null)
        {
            string       skillFilePath = skillfilePrefix + skillData.SkillDataFile;
            StreamWriter skillFilesw   = new StreamWriter(skillFilePath, false, Encoding.UTF8);

            _GenerateSkillImpl(skillFilesw, skillId, anim, hitType, animLen);

            // 三段普攻
            if (bNormalAttack)
            {
                // 第二段
                if (skillData.NextSkillId > 0)
                {
                    _GenerateSkillImpl(skillFilesw, skillData.NextSkillId, 普通攻击第二段.技能动画, 普通攻击第二段.攻击类型, 普通攻击第二段.动画长度);
                }
                else
                {
                    UnityEditor.EditorUtility.DisplayDialog("SkillEdit", "普攻第二段next skill id没配置,请联系程序!", "OK");
                }

                // 第三段
                skillData = (ArkCrossEngine.SkillLogicData)ArkCrossEngine.SkillConfigProvider.Instance.ExtractData(ArkCrossEngine.SkillConfigType.SCT_SKILL, skillData.NextSkillId);

                if (skillData.NextSkillId > 0)
                {
                    _GenerateSkillImpl(skillFilesw, skillData.NextSkillId, 普通攻击第三段.技能动画, 普通攻击第三段.攻击类型, 普通攻击第三段.动画长度);
                }
                else
                {
                    UnityEditor.EditorUtility.DisplayDialog("SkillEdit", "普攻第三段next skill id没配置,请联系程序!", "OK");
                }
            }

            skillFilesw.Flush();
            skillFilesw.Close();
        }
    }
Exemplo n.º 8
0
        /// <summary>
        /// 计算实际攻击影响
        /// </summary>
        public static int ComputeAttackImpact(double attackTotal, double defendTotal, eHitType hitType, RoleActor owner, RoleActor target)
        {
            //免伤率=防御/(防御参数+防御)*min(0.9/0.8,防御方等级/攻击方等级)
            //其中防御参数=1400
            var defRate = defendTotal / (1400 + defendTotal) * Math.Min(0.9 / 0.8, target.RoleLevel / owner.RoleLevel);

            if (defRate > 1)
            {
                defRate = 1;
            }
            if (defRate < 0)
            {
                defRate = 0;
            }

            double dmg = attackTotal * (1 - defRate);                                               //skAtk * skAtk / (skAtk + def);

            dmg = dmg * (1 + owner.FinalRoleValue.UpHurtRate - target.FinalRoleValue.DownHurtRate); //伤害加深或者削弱

            if (hitType == eHitType.Crit)
            {
                dmg *= 1.5f;
            }
            else if (hitType == eHitType.Deadly)
            {
                dmg *= 2.5f;
            }
            else if (hitType == eHitType.Block)
            {
                dmg *= 0.5f;
            }

            int damageHP = -1 * (int)dmg;

            //if (target.CurHP + damageHP < 0)
            //    damageHP = -1 * target.CurHP;
            return(damageHP);
        }
Exemplo n.º 9
0
	public Tbl_Action_HitInfo(XmlNode _node)
	{
		try{
			m_HitType = (eHitType)Enum.Parse(typeof(eHitType), _node.Attributes["HitType"].Value, true);
			m_HitMultiTargetCount = int.Parse(_node.Attributes["MultiTargetCount"].Value);
			m_HitTiming = float.Parse(_node.Attributes["Timing"].Value);
			m_HitProjectileName = _node.Attributes["ProjectileFilePath"].Value;
			m_HitProjectileHitFileName = _node.Attributes["ProjectileHitFilePath"].Value;
			
			m_HitProjectileSpeed = float.Parse(_node.Attributes["ProjectileSpeed"].Value);		
			m_HitProjectileAccel = float.Parse(_node.Attributes["ProjectileAcceleration"].Value);
			m_HitProjectilePath = (eProjectilePath)Enum.Parse(typeof(eProjectilePath), _node.Attributes["ProjectilePath"].Value, true);
			m_HitValuePercent = float.Parse(_node.Attributes["ValuePercent"].Value);
			m_HitValueLookType = (eValueLookType)Enum.Parse(typeof(eValueLookType), _node.Attributes["ValueLookType"].Value, true);
			
			m_HitValueLookDuration = float.Parse(_node.Attributes["ValueLookDuration"].Value);
			m_HitValueLookCount = int.Parse(_node.Attributes["ValueLookCount"].Value);
			m_HitProjectileHitSoundPath = _node.Attributes["ProjectileHitSoundPath"].Value;
			
			XmlNode nodeArea = _node.NextSibling;
			while(true)
			{
				if(nodeArea == null)
					break;
				
				Tbl_Action_AreaInfo areaInfo = new Tbl_Action_AreaInfo(nodeArea);
				m_AreaInfo.Add(areaInfo);
				
				nodeArea = nodeArea.NextSibling;
			}
		}
		catch(Exception e){
			Debug.LogError(e);
		}
	}
Exemplo n.º 10
0
	public Tbl_Action_HitInfo_(XmlNode _node)
	{
		try{
			m_HitType = (eHitType)Enum.Parse(typeof(eHitType), _node.Attributes["HitType"].Value, true);
			m_HitTiming = float.Parse(_node.Attributes["Timing"].Value);
			m_HitProjectileName = _node.Attributes["ProjectileFilePath"].Value;
			m_HitProjectileHitFileName = _node.Attributes["ProjectileHitFilePath"].Value;
			m_HitProjectileSpeed = float.Parse(_node.Attributes["ProjectileSpeed"].Value);
			m_HitProjectileAccel = float.Parse(_node.Attributes["ProjectileAcceleration"].Value);
			m_HitProjectilePath = (eProjectilePath)Enum.Parse(typeof(eProjectilePath), _node.Attributes["ProjectilePath"].Value, true);
			m_HitAreaShape = (eHitAreaShape)Enum.Parse(typeof(eHitAreaShape), _node.Attributes["AreaShape"].Value, true);
			m_HitAngle = float.Parse(_node.Attributes["Angle"].Value);
			m_HitCenterDirectionAngle = float.Parse(_node.Attributes["CenterDirectionAngle"].Value);
			m_HitMinDistance = float.Parse(_node.Attributes["MinDistance"].Value);
			m_HitMaxDistance = float.Parse(_node.Attributes["MaxDistance"].Value);
			m_HitWidth = float.Parse(_node.Attributes["Width"].Value);
			m_HitHeight = float.Parse(_node.Attributes["Height"].Value);
			m_HitOffsetX = float.Parse(_node.Attributes["OffsetX"].Value);
			m_HitOffsetY = float.Parse(_node.Attributes["OffsetY"].Value);
			m_HitValuePercent = float.Parse(_node.Attributes["ValuePercent"].Value);
			m_HitValueLookType = (eValueLookType)Enum.Parse(typeof(eValueLookType), _node.Attributes["ValueLookType"].Value, true);
			m_HitValueLookDuration = float.Parse(_node.Attributes["ValueLookDuration"].Value);
			m_HitValueLookCount = int.Parse(_node.Attributes["ValueLookCount"].Value);
			m_HitProjectileHitSoundPath = _node.Attributes["ProjectileHitSoundPath"].Value;
		}
		catch(Exception e){
			Debug.LogError(e);
		}
	}