public BuffProp(BuffProp buffProp) { if (buffProp == null) { return; } this.Constitution = buffProp.Constitution; this.Strength = buffProp.Strength; this.Agility = buffProp.Agility; this.Energy = buffProp.Energy; this.Dexterous = buffProp.Dexterous; this.Concentration = buffProp.Concentration; this.AllPoints = buffProp.AllPoints; this.Energy = buffProp.Energy; this.HealthLevel = buffProp.HealthLevel; this.HealthRecovery = buffProp.HealthRecovery; this.StaminaRecovery = buffProp.StaminaRecovery; }
/// <summary> /// 创建角色(base,无装备,有武器) /// </summary> /// <param name="id">ID</param> /// <param name="name">名字</param> /// <param name="faction">势力(玩家,友军,敌人)</param> /// <param name="type">(英雄,普通)</param> /// <param name="constitution">体质</param> /// <param name="strength">力量</param> /// <param name="agility">灵巧</param> /// <param name="dexterous">洞察</param> /// <param name="concentration">专注</param> /// <param name="weapon">武器</param> /// <param name="allExperience">全部经验</param> /// <param name="skills">技能</param> /// <param name="currentExperience">当前经验</param> public CharacterProperty(int id, string name, CharacterFaction faction, CharacterType type, string sprite, CharacterKind kind, int constitution, int strength, int agility, int dexterous, int concentration, Item weapon, float allExperience, float resistance = 0, int[] skills = null, float currentExperience = 0, int headID = 0, int clothID = 0, int pantsID = 0, int beltID = 0, BuffProp buffProp = null) { #region 装备处理 if (this.EquipmentProp == null) { this.EquipmentProp = new EquipProp(headID, clothID, pantsID, beltID); } if ((headID != 0) || (clothID != 0) || (pantsID != 0) || (beltID != 0)) { this.EquipmentProp = new EquipProp(headID, clothID, pantsID, beltID); resistance += EquipmentProp.Resistance; constitution += EquipmentProp.Constitution; strength += EquipmentProp.Strength; dexterous += EquipmentProp.Dexterous; agility += EquipmentProp.Agility; concentration += EquipmentProp.Concentration; } #endregion #region 加成处理 if (buffProp != null) { this.BuffItemProp = buffProp; constitution += buffProp.Constitution; strength += buffProp.Strength; dexterous += buffProp.Dexterous; agility += buffProp.Agility; concentration += buffProp.Concentration; //else ... } #endregion this.ID = id; this.Name = name; this.Faction = faction; this.Type = type; this.Sprite = sprite; this.AllExperience = allExperience; this.Resistance = resistance; this.Constitution = constitution; this.Strength = strength; this.Agility = agility; this.Dexterous = dexterous; this.Concentration = concentration; this.HealthLevel = 100; this.charKind = kind; this.Level = CountLevel(allExperience, out currentExperience); this.CurrentExperience = currentExperience; this.Power = constitution + strength + agility + dexterous + concentration; this.WeaponWith = weapon; //通常角色 if (type == CharacterType.Common) { this.MaxHealth = 100 + 3 * constitution; this.MaxStamina = 100 + 1 * constitution; this.HealthRecovery = 0.2f; this.StaminaRecovery = 5f; this.MoveSpeed = 1.3f * (1 + 0.01f * agility); this.AimingSpeed = 2 * (1 + 0.02f * concentration); this.Critical = 0.1f + 0.01f * dexterous; this.MeleeRaise = 1.5f; this.ShootRaise = 1.5f; this.ThrowRaise = 1.5f; this.MaxAngle = 10 * (1 - 0.01f * concentration); this.KickDamage = 20 + strength; this.PunchDamage = 20 + strength; if (weapon is MeleeWeapon) { MeleeWeapon melee = (MeleeWeapon)weapon; this.MeleeDamage = melee.MeleeDamage + strength; this.ThrowDamage = melee.ThrowDamage + strength; this.AttackInterval = melee.AttackInterval * (1 - 0.02f * agility); } else if (weapon is ShootWeapon) { ShootWeapon shoot = (ShootWeapon)weapon; this.MinAngle = (110 - shoot.Accuracy / 15); this.Capacity = shoot.Accuracy * MaxAngle / 10; this.PullingTime = shoot.LaShuanTime * (1 - 0.02f * agility); this.ReloadTime = shoot.ReloadTime * (1 - 0.01f * agility); this.MeleeDamage = shoot.MeleeDamage + strength; this.ShootDamage = shoot.ShootDamage; this.AttackInterval = shoot.AttackInterval * (1 - 0.01f * agility); this.DeclineRange = shoot.DamageRange; } } //英雄角色 else if (type == CharacterType.Hero) { this.SkillA = skills[0]; this.SkillB = skills[1]; this.SkillC = skills[2]; this.SkillD = skills[3]; this.SkillE = skills[4]; this.SkillF = skills[5]; this.SkillG = skills[6]; this.SkillH = skills[7]; this.SkillI = skills[8]; this.SkillJ = skills[9]; this.SkillK = skills[10]; this.SkillL = skills[11]; this.SkillM = skills[12]; this.SkillN = skills[13]; this.SkillO = skills[14]; this.SkillP = skills[15]; this.SkillQ = skills[16]; this.SkillR = skills[17]; this.SkillS = skills[18]; this.SkillT = skills[19]; this.MaxHealth = 100 + 3 * constitution + 20 * SkillA; this.MaxStamina = 100 + 1 * constitution + 20 * SkillF; this.HealthRecovery = 0.2f + 2 * SkillM + 100 * SkillN; this.StaminaRecovery = 5 + 2 * SkillL; this.MoveSpeed = 1.3f * (1 + 0.01f * agility + 0.15f * SkillR); this.AimingSpeed = 2f * (1 + 0.02f * concentration + 0.1f * SkillQ); this.Critical = 0.1f + 0.01f * dexterous + 0.04f * SkillD; this.MeleeRaise = 1.5f + 0.5f * SkillI; this.ShootRaise = 1.5f + 0.5f * SkillJ; this.ThrowRaise = 1.5f + 1 * SkillT; this.MaxAngle = 10 * (1 - 0.01f * concentration - 0.04f * SkillE); this.Resistance = this.Resistance + 0.04f * SkillG + 0.1f * SkillN; this.KickDamage = 20 + 20 * SkillH; if (weapon is MeleeWeapon) { MeleeWeapon melee = (MeleeWeapon)weapon; this.MeleeDamage = (melee.MeleeDamage + strength) * (1 + 0.04f * SkillB); this.AttackInterval = melee.AttackInterval * (1 - 0.02f * agility - 0.04f * SkillC); this.ThrowDamage = melee.ThrowDamage * (1 + SkillT) + strength; } else if (weapon is ShootWeapon) { ShootWeapon shoot = (ShootWeapon)weapon; this.MinAngle = (110 - shoot.Accuracy / 15) * (1 - 0.1f * SkillP); this.Capacity = shoot.Accuracy * MaxAngle / 10f; this.ReloadTime = shoot.ReloadTime * (1 - 0.01f * agility - 0.1f * SkillO); this.PullingTime = shoot.LaShuanTime * (1 - 0.02f * agility - 0.08f * SkillK); this.MeleeDamage = (shoot.MeleeDamage * (1 + SkillT) + strength) * (1 + 0.04f * SkillB); this.ShootDamage = shoot.ShootDamage; this.AttackInterval = shoot.AttackInterval * (1 - 0.01f * agility - 0.04f * SkillC); } } }