public virtual bool CheckSelf(Entity caster, int skillLevel) { // has a weapon (important for projectiles etc.), no cooldown, hp, mp? return(caster.Health > 0 && caster.Mind >= mindCosts.Get(skillLevel) && caster.GetEquippedWeaponCategory().StartsWith(requiredWeaponCategory)); }
// 1. self check: alive, enough mana, cooldown ready etc.? // (most skills can only be cast while alive. some maybe while dead or only // if we have ammo, etc.) public virtual bool CheckSelf(Entity caster, int skillLevel) { // has a weapon (important for projectiles etc.), no cooldown, hp, mp? // note: only require equipment if requried weapon category != "" return(caster.health.current > 0 && caster.mana.current >= manaCosts.Get(skillLevel) && CheckWeapon(caster)); }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { List <Entity> targets = new List <Entity>(); if (caster is Player) { targets = ((Player)caster).UCE_GetCorrectedTargetsInSphere(caster.transform, castRange.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } else { targets = caster.UCE_GetCorrectedTargetsInSphere(caster.transform, castRange.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } foreach (Entity target in targets) { target.UCE_CleanupStatusBuffs(successChance.Get(skillLevel)); target.health += healsHealth.Get(skillLevel); target.mana += healsMana.Get(skillLevel); target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); SpawnEffect(caster, target); if (UnityEngine.Random.value <= triggerAggroChance.Get(skillLevel)) { target.target = caster; } } targets.Clear(); }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { List <Entity> targets = new List <Entity>(); if (caster is Player) { targets = ((Player)caster).UCE_GetCorrectedTargetsInSphere(caster.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, false, true, true); } else { targets = caster.UCE_GetCorrectedTargetsInSphere(caster.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, false, true, true); } foreach (Entity target in targets) { if (UnityEngine.Random.value <= successChance.Get(skillLevel)) { target.UCE_OnAggro(caster, 1); target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); SpawnEffect(caster, target); } } targets.Clear(); }
// OnCastCanceled doesn't seem worth the Rpc bandwidth, since skill effects // can check if caster.currentSkill == -1 // tooltip ///////////////////////////////////////////////////////////////// // fill in all variables into the tooltip // this saves us lots of ugly string concatenation code. // (dynamic ones are filled in Skill.cs) // -> note: each tooltip can have any variables, or none if needed // -> example usage: /* * <b>{NAME}</b> * Description here... * * Damage: {DAMAGE} * Cast Time: {CASTTIME} * Cooldown: {COOLDOWN} * Cast Range: {CASTRANGE} * AoE Radius: {AOERADIUS} * Mana Costs: {MANACOSTS} */ public virtual string ToolTip(int level, bool showRequirements = false) { // note: caching StringBuilder is worse for GC because .Clear frees the internal array and reallocates. StringBuilder tip = new StringBuilder(toolTip); tip.Replace("{NAME}", name); tip.Replace("{LEVEL}", level.ToString()); tip.Replace("{CASTTIME}", Utils.PrettySeconds(castTime.Get(level))); tip.Replace("{COOLDOWN}", Utils.PrettySeconds(cooldown.Get(level))); tip.Replace("{CASTRANGE}", castRange.Get(level).ToString()); tip.Replace("{MANACOSTS}", manaCosts.Get(level).ToString()); // only show requirements if necessary if (showRequirements) { tip.Append("\n<b><i>Required Level: " + requiredLevel.Get(1) + "</i></b>\n" + "<b><i>Required Skill Exp.: " + requiredSkillExperience.Get(1) + "</i></b>\n"); if (predecessor != null) { tip.Append("<b><i>Required Skill: " + predecessor.name + " Lv. " + predecessorLevel + " </i></b>\n"); } } return(tip.ToString()); }
// tooltip ///////////////////////////////////////////////////////////////// public override string ToolTip(int skillLevel, bool showRequirements = false) { StringBuilder tip = new StringBuilder(base.ToolTip(skillLevel, showRequirements)); tip.Replace("{HEALSHEALTH}", healsHealth.Get(skillLevel).ToString()); tip.Replace("{HEALSMANA}", healsMana.Get(skillLevel).ToString()); return(tip.ToString()); }
public LinearFloat stunTime; // in seconds // tooltip public override string ToolTip(int skillLevel, bool showRequirements = false) { StringBuilder tip = new StringBuilder(base.ToolTip(skillLevel, showRequirements)); tip.Replace("{DAMAGE}", damage.Get(skillLevel).ToString()); tip.Replace("{STUNCHANCE}", Mathf.RoundToInt(stunChance.Get(skillLevel) * 100).ToString()); tip.Replace("{STUNTIME}", stunTime.Get(skillLevel).ToString("F1")); return(tip.ToString()); }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { _caster = caster; _skillLevel = skillLevel; // ------ consume ammo if needed ConsumeRequiredWeaponsAmmo(caster); // default ammo system ConsumeAmmunition(caster); // custom ammo system // ------ create muzzle effect if any if (muzzleEffect != null) { GameObject go = Instantiate(muzzleEffect.gameObject, caster.effectMount.position, caster.effectMount.rotation); NetworkServer.Spawn(go); } #if _iMMOPROJECTILES // ------ spawn one or more projectiles if any if (projectile != null) { SpawnProjectile(); } #endif // ------ Apply Caster Buff if (applyCasterBuff.Length > 0 && applyCasterBuff.Length >= skillLevel && applyCasterBuff[skillLevel - 1] != null) { caster.UCE_ApplyBuff(applyCasterBuff[skillLevel - 1], buffCasterLevel.Get(skillLevel), buffCasterChance.Get(skillLevel)); } // ------ Remove Caster Buff if (removeRandomCasterBuff.Get(skillLevel) > 0 && caster.buffs.Count > 0) { caster.UCE_CleanupStatusBuffs(removeCasterBuffChance.Get(skillLevel), 0, removeRandomCasterBuff.Get(skillLevel)); } // ------ Recoil Caster if (recoilCaster.Get(skillLevel) > 0) { caster.UCE_Recoil(caster, recoilCaster.Get(skillLevel)); } }
// ----------------------------------------------------------------------------------- // Use // ----------------------------------------------------------------------------------- public override void Use(Player player, int inventoryIndex) { List <Entity> targets = new List <Entity>(); ItemSlot slot = player.inventory.slots[inventoryIndex]; // -- Only activate if enough charges left if (decreaseAmount == 0 || slot.amount >= decreaseAmount) { // always call base function too base.Use(player, inventoryIndex); targets = player.UCE_GetCorrectedTargetsInSphere(player.transform, radius, false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); foreach (Entity target in targets) { int dmg = damage.Get(skillLevel); if (useCasterDamage) { dmg += player.combat.damage; } float buffModifier = 0; #if _iMMOATTRIBUTES if (useCasterAccuracy) { buffModifier = target.UCE_HarmonizeChance(buffModifier, player.accuracy); } #endif // deal damage directly with base damage + skill damage player.DealDamageAt(target, dmg, stunChance.Get(skillLevel), stunTime.Get(skillLevel)); target.UCE_ApplyBuff(applyBuff, buffLevel, buffChance, buffModifier); player.UCE_TargetAddMessage(successMessage + target.name); SpawnEffect(player, player.target); if (UnityEngine.Random.value <= triggerAggroChance) { target.target = player; } } // decrease amount slot.DecreaseAmount(decreaseAmount); player.inventory.slots[inventoryIndex] = slot; } targets.Clear(); }
public override void Apply(Entity caster, int skillLevel) { // deal damage directly with base damage + skill damage caster.DealDamageAt(caster.target, caster.combat.damage + damage.Get(skillLevel), stunChance.Get(skillLevel), stunTime.Get(skillLevel)); // apply the buff caster.target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); }
// ----------------------------------------------------------------------------------- // // ----------------------------------------------------------------------------------- // (has corrected target already) public override void Apply(Entity caster, int skillLevel) { // apply only to dead people if (caster.target != null && !caster.target.isAlive) { caster.target.health += healsHealth.Get(skillLevel); caster.target.mana += healsMana.Get(skillLevel); caster.target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); caster.target.UCE_OverrideState("IDLE"); // show effect on target SpawnEffect(caster, caster.target); } }
public LinearFloat bonusSpeed; // can be negative too // tooltip public override string ToolTip(int skillLevel, bool showRequirements = false) { StringBuilder tip = new StringBuilder(base.ToolTip(skillLevel, showRequirements)); tip.Replace("{BONUSHEALTHMAX}", bonusHealthMax.Get(skillLevel).ToString()); tip.Replace("{BONUSMANAMAX}", bonusManaMax.Get(skillLevel).ToString()); tip.Replace("{BONUSDAMAGE}", bonusDamage.Get(skillLevel).ToString()); tip.Replace("{BONUSDEFENSE}", bonusDefense.Get(skillLevel).ToString()); tip.Replace("{BONUSBLOCKCHANCE}", Mathf.RoundToInt(bonusBlockChance.Get(skillLevel) * 100).ToString()); tip.Replace("{BONUSCRITICALCHANCE}", Mathf.RoundToInt(bonusCriticalChance.Get(skillLevel) * 100).ToString()); tip.Replace("{BONUSHEALTHPERCENTPERSECOND}", Mathf.RoundToInt(bonusHealthPercentPerSecond.Get(skillLevel) * 100).ToString()); tip.Replace("{BONUSMANAPERCENTPERSECOND}", Mathf.RoundToInt(bonusManaPercentPerSecond.Get(skillLevel) * 100).ToString()); tip.Replace("{BONUSSPEED}", bonusSpeed.Get(skillLevel).ToString("F2")); return(tip.ToString()); }
// ----------------------------------------------------------------------------------- // CheckDistance // ----------------------------------------------------------------------------------- public override bool CheckDistance(Entity caster, int skillLevel, out Vector3 destination) { if (caster.target != null && caster.target is Monster) { int maxLevel = maxTargetLevel.Get(skillLevel); if (basePlayerLevel) { maxLevel += caster.level; } Monster monster = caster.target.GetComponent <Monster>(); if (monster.level <= maxLevel) { destination = caster.target.collider.ClosestPointOnBounds(caster.transform.position); return(Utils.ClosestDistance(caster, caster.target) <= castRange.Get(skillLevel)); } } ((Player)caster).UCE_TargetAddMessage(errorMessage); destination = caster.transform.position; return(false); }
public LinearFloat speedBonus; // can be negative too // tooltip public override string ToolTip(int skillLevel, bool showRequirements = false) { StringBuilder tip = new StringBuilder(base.ToolTip(skillLevel, showRequirements)); tip.Replace("{HEALTHMAXBONUS}", healthMaxBonus.Get(skillLevel).ToString()); tip.Replace("{MANAMAXBONUS}", manaMaxBonus.Get(skillLevel).ToString()); tip.Replace("{DAMAGEBONUS}", damageBonus.Get(skillLevel).ToString()); tip.Replace("{DEFENSEBONUS}", defenseBonus.Get(skillLevel).ToString()); tip.Replace("{BLOCKCHANCEBONUS}", Mathf.RoundToInt(blockChanceBonus.Get(skillLevel) * 100).ToString()); tip.Replace("{CRITICALCHANCEBONUS}", Mathf.RoundToInt(criticalChanceBonus.Get(skillLevel) * 100).ToString()); tip.Replace("{HEALTHPERCENTPERSECONDBONUS}", Mathf.RoundToInt(healthPercentPerSecondBonus.Get(skillLevel) * 100).ToString()); tip.Replace("{MANAPERCENTPERSECONDBONUS}", Mathf.RoundToInt(manaPercentPerSecondBonus.Get(skillLevel) * 100).ToString()); tip.Replace("{SPEEDBONUS}", speedBonus.Get(skillLevel).ToString("F2")); return(tip.ToString()); }
// ----------------------------------------------------------------------------------- // // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { // apply only to alive people if (caster.target != null && caster.target.isAlive) { caster.target.UCE_CleanupStatusBuffs(successChance.Get(skillLevel)); caster.target.health.current += healsHealth.Get(skillLevel); caster.target.mana.current += healsMana.Get(skillLevel); caster.target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); SpawnEffect(caster, caster.target); } }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { List <Entity> targets = new List <Entity>(); if (caster is Player) { targets = ((Player)caster).UCE_GetCorrectedTargetsInSphere(caster.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } else { targets = caster.UCE_GetCorrectedTargetsInSphere(caster.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } foreach (Entity target in targets) { int dmg = damage.Get(skillLevel); if (useCasterDamage) { dmg += caster.combat.damage; } #if _iMMOATTRIBUTES float buffModifier = 0; if (useCasterAccuracy) { buffModifier = target.UCE_HarmonizeChance(buffModifier, caster.accuracy); } #endif // deal damage directly with base damage + skill damage caster.DealDamageAt(target, dmg, stunChance.Get(skillLevel), stunTime.Get(skillLevel)); target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); SpawnEffect(caster, target); if (UnityEngine.Random.value <= triggerAggroChance.Get(skillLevel)) { target.target = caster; } } targets.Clear(); }
// ----------------------------------------------------------------------------------- // // ----------------------------------------------------------------------------------- // (has corrected target already) public override void Apply(Entity caster, int skillLevel) { // apply only to alive people if (caster.target != null && caster.target is Player && caster.target.isAlive) { ((Player)caster.target).UCE_UnequipCursedEquipment(maxCurseLevel); caster.target.health += healsHealth.Get(skillLevel); caster.target.mana += healsMana.Get(skillLevel); caster.target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); // show effect on target SpawnEffect(caster, caster.target); } }
// ----------------------------------------------------------------------------------- // Use // ----------------------------------------------------------------------------------- public override void Use(Player player, int inventoryIndex) { List <Entity> targets = new List <Entity>(); ItemSlot slot = player.inventory[inventoryIndex]; // -- Only activate if enough charges left if (decreaseAmount == 0 || slot.amount >= decreaseAmount) { // always call base function too base.Use(player, inventoryIndex); if (SpawnEffectOnMainTargetOnly) { SpawnEffect(player, player.target); } targets = player.UCE_GetCorrectedTargetsInSphere(player.target.transform, radius, false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); foreach (Entity target in targets) { // deal damage directly with base damage + skill damage player.DealDamageAt(target, player.damage + damage.Get(skillLevel), stunChance.Get(skillLevel), stunTime.Get(skillLevel)); target.UCE_ApplyBuff(applyBuff, buffLevel, buffChance); player.UCE_TargetAddMessage(successMessage + target.name); if (!SpawnEffectOnMainTargetOnly) { SpawnEffect(player, target); } if (UnityEngine.Random.value <= triggerAggroChance) { target.target = player; } } // decrease amount slot.DecreaseAmount(decreaseAmount); player.inventory[inventoryIndex] = slot; } targets.Clear(); }
// ----------------------------------------------------------------------------------- // // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { // apply only to alive people if (caster.target != null && caster.target.isAlive) { foreach (BuffSkill removeBuff in removeBuffs) { caster.target.UCE_RemoveBuff(removeBuff, successChance.Get(skillLevel)); } caster.target.health += healsHealth.Get(skillLevel); caster.target.mana += healsMana.Get(skillLevel); caster.target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); SpawnEffect(caster, caster.target); } }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { List <Entity> targets = new List <Entity>(); if (SpawnEffectOnMainTargetOnly) { SpawnEffect(caster, caster.target); } if (caster is Player) { targets = ((Player)caster).UCE_GetCorrectedTargetsInSphere(caster.target.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } else { targets = caster.UCE_GetCorrectedTargetsInSphere(caster.target.transform, castRadius.Get(skillLevel), false, affectSelf, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectMonsters, affectPets); } foreach (Entity target in targets) { // deal damage directly with base damage + skill damage caster.DealDamageAt(target, caster.combat.damage + damage.Get(skillLevel), stunChance.Get(skillLevel), stunTime.Get(skillLevel)); target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); if (!SpawnEffectOnMainTargetOnly) { SpawnEffect(caster, target); } if (UnityEngine.Random.value <= triggerAggroChance.Get(skillLevel)) { target.target = caster; } } targets.Clear(); }
// ----------------------------------------------------------------------------------- // AffectDetectedTargets // ----------------------------------------------------------------------------------- protected void AffectDetectedTargets(Entity caster, int skillLevel) { int hits = UnityEngine.Random.Range(minHitsPerTarget.Get(skillLevel), maxHitsPerTarget.Get(skillLevel)); if (hits <= 0 || castRange.Get(skillLevel) <= 0) { return; } correctedTargets.Clear(); int layerMask = ~(1 << 2); //2= ignore raycast Collider[] hitColliders = Physics.OverlapSphere(caster.transform.position, castRange.Get(skillLevel), layerMask); foreach (Collider hitCollider in hitColliders) { Entity target = hitCollider.GetComponentInParent <Entity>(); if (target != null && target != caster && caster.CanAttack(target) && !correctedTargets.Any(x => x == target)) { Vector3 direction = target.transform.position - caster.transform.position; float angle = Vector3.Angle(direction, caster.transform.forward); if (angle >= minAngle.Get(skillLevel) && angle <= maxAngle.Get(skillLevel)) { correctedTargets.Add(target); } } } foreach (Entity detectedTarget in correctedTargets) { for (int i = 0; i < hits; i++) { OnSkillImpact(caster, detectedTarget, skillLevel); } } }
public virtual string ToolTip(int level, bool showRequirements = false) { StringBuilder tip = new StringBuilder(toolTip); tip.Replace("{名称}", name); tip.Replace("{等级}", level.ToString()); tip.Replace("{持续时间}", Utility.PrettySeconds(castTime.Get(level))); tip.Replace("{冷却时间}", Utility.PrettySeconds(cooldown.Get(level))); tip.Replace("{施法距离}", castRange.Get(level).ToString()); tip.Replace("{脑力消耗}", mindCosts.Get(level).ToString()); // only show requirements if necessary if (showRequirements) { tip.Append("\n<b><i>Required Level: " + requiredLevel.Get(1) + "</i></b>\n" + "<b><i>Required Skill Exp.: " + requiredSkillExperience.Get(1) + "</i></b>\n"); if (predecessor != null) { tip.Append("<b><i>Required Skill: " + predecessor.name + " Lv. " + predecessorLevel + " </i></b>\n"); } } return(tip.ToString()); }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { List <Entity> targets = new List <Entity>(); if (caster is Player) { targets = ((Player)caster).UCE_GetCorrectedTargetsInSphere(caster.transform, castRange.Get(skillLevel), true, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectEnemies, affectPets); } else { targets = caster.UCE_GetCorrectedTargetsInSphere(caster.transform, castRange.Get(skillLevel), true, affectOwnParty, affectOwnGuild, affectOwnRealm, reverseTargeting, affectPlayers, affectEnemies, affectPets); } foreach (Entity target in targets) { target.health.current += healsHealth.Get(skillLevel); target.mana.current += healsMana.Get(skillLevel); target.UCE_ApplyBuff(applyBuff, buffLevel.Get(skillLevel), buffChance.Get(skillLevel)); target.UCE_OverrideState("IDLE"); SpawnEffect(caster, target); } targets.Clear(); }
// ----------------------------------------------------------------------------------- // SpawnProjectile // ----------------------------------------------------------------------------------- #if _iMMOPROJECTILES protected void SpawnProjectile() { GameObject go = Instantiate(projectile.gameObject, _caster.effectMount.position, _caster.effectMount.rotation); UCE_Projectile effect = go.GetComponent <UCE_Projectile>(); effect.speed = projectileSpeed.Get(_skillLevel); effect.target = _caster.target; effect.caster = _caster; effect.data.speed = projectileSpeed.Get(_skillLevel); effect.data.distance = castRange.Get(_skillLevel); effect.data.skillLevel = _skillLevel; effect.data.damage = damage.Get(_skillLevel); effect.data.addCasterDamage = addCasterDamage; effect.data.stunChance = stunChance.Get(_skillLevel); effect.data.stunAddAccuracy = stunAddAccuracy; effect.data.minStunTime = minStunTime.Get(_skillLevel); effect.data.maxStunTime = maxStunTime.Get(_skillLevel); effect.data.sidekick = false; effect.data.sidekickSpawnChance = sidekickSpawnChance.Get(_skillLevel); effect.data.sidekickAmount = sidekickAmount.Get(_skillLevel); effect.data.sidekickSpawnDelay = sidekickSpawnDelay; effect.data.sidekickSpreadAngle = sidekickSpreadAngle; effect.data.recoilCaster = recoilCaster.Get(_skillLevel); effect.data.minRecoilTarget = minRecoilTarget.Get(_skillLevel); effect.data.maxRecoilTarget = maxRecoilTarget.Get(_skillLevel); effect.data.recoilChance = recoilChance.Get(_skillLevel); effect.data.recoilAddAccuracy = recoilAddAccuracy; effect.data.cooldownChance = cooldownChance.Get(_skillLevel); effect.data.cooldownDuration = cooldownDuration.Get(_skillLevel); effect.data.cooldownAddAccuracy = cooldownAddAccuracy; if (applyBuff.Length > 0 && applyBuff.Length >= _skillLevel - 1) { effect.data.applyBuff = applyBuff[_skillLevel - 1]; effect.data.buffLevel = buffLevel.Get(_skillLevel); effect.data.buffChance = buffChance.Get(_skillLevel); effect.data.buffAddAccuracy = buffAddAccuracy; } effect.data.impactEffect = impactEffect; effect.data.impactRadius = impactRadius.Get(_skillLevel); effect.data.triggerAggroChance = triggerAggroChance.Get(_skillLevel); effect.data.visualEffectOnMainTargetOnly = visualEffectOnMainTargetOnly; effect.data.reverseTargeting = reverseTargeting; effect.data.notAffectSelf = notAffectSelf; effect.data.notAffectOwnParty = notAffectOwnParty; effect.data.notAffectOwnGuild = notAffectOwnGuild; effect.data.notAffectOwnRealm = notAffectOwnRealm; effect.data.notAffectPlayers = notAffectPlayers; effect.data.notAffectMonsters = notAffectMonsters; effect.data.notAffectPets = notAffectPets; effect.data.removeRandomBuff = removeRandomBuff.Get(_skillLevel); effect.data.removeChance = removeChance.Get(_skillLevel); effect.data.removeAddAccuracy = removeAddAccuracy; effect.data.createOnTarget = createOnTarget; effect.data.createChance = createChance.Get(_skillLevel); effect.data.sidekicksDontStun = sidekicksDontStun; effect.data.sidekicksDontBuff = sidekicksDontBuff; effect.data.sidekicksDontRecoil = sidekicksDontRecoil; effect.data.sidekicksDontDebuff = sidekicksDontDebuff; effect.data.sidekicksDontAOE = sidekicksDontAOE; effect.data.sidekicksDontCreateObject = sidekicksDontCreateObject; effect.Init(); NetworkServer.Spawn(go); }
// ----------------------------------------------------------------------------------- // ApplyToTargets // ----------------------------------------------------------------------------------- public void ApplyToTargets(List <Entity> targets, Entity caster, int skillLevel) { // ---------------------------------------------------------- Apply to all targets foreach (Entity target in targets) { int oldHealth = target.health; int hldHealth = 0; float buffModifier = 0; // ---------------------------------------------------------------- Revive Dead if (!target.isAlive && reviveChance.Get(skillLevel) > 0 && UnityEngine.Random.value <= reviveChance.Get(skillLevel)) { target.health += 1; target.UCE_OverrideState("IDLE"); caster.UCE_TargetAddMessage(string.Format(labelCasterRevive, target.name)); if (target != caster) { target.UCE_TargetAddMessage(string.Format(labelTargetRevive, caster.name)); } } // ---------------------------------------------------------------- Heal if (target.isAlive && healsHealth.Get(skillLevel) > 0 || healsMana.Get(skillLevel) > 0) { target.health += healsHealth.Get(skillLevel); target.mana += healsMana.Get(skillLevel); hldHealth = target.health - oldHealth; if (hldHealth != 0) { target.RpcOnHealingReceived(hldHealth); if (caster is Player) { caster.UCE_TargetAddMessage(string.Format(labelCasterHeal, target.name, hldHealth.ToString())); if (target != caster) { target.UCE_TargetAddMessage(string.Format(labelTargetHeal, caster.name, hldHealth.ToString())); } } } } // ---------------------------------------------------------------- Debuff if (removeBuffType != BuffType.None || removeBuffs.Length > 0) { foreach (BuffSkill removeBuff in removeBuffs) { target.UCE_RemoveBuff(removeBuff, debuffChance.Get(skillLevel), buffModifier); } #if _iMMOATTRIBUTES buffModifier = (debuffAddAccuracy) ? target.UCE_HarmonizeChance(0, caster.accuracy) : 0f; #endif if (removeBuffType == BuffType.Buff) { target.UCE_CleanupStatusBuffs(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } else if (removeBuffType == BuffType.Nerf) { target.UCE_CleanupStatusNerfs(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } else if (removeBuffType == BuffType.Both) { target.UCE_CleanupStatusAny(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } } // ---------------------------------------------------------------- Buff if (target.isAlive && applyBuffs.Length > 0) { #if _iMMOATTRIBUTES buffModifier = (buffAddAccuracy) ? target.UCE_HarmonizeChance(0, caster.accuracy) : 0f; #endif target.UCE_ApplyBuffs(applyBuffs, buffLevel.Get(skillLevel), buffChance.Get(skillLevel), buffModifier, buffAmount.Get(skillLevel)); } // ---------------------------------------------------------------- Effects // -- check for unstun if (unstunChance.Get(skillLevel) > 0 && target.UCE_Stunned() && UnityEngine.Random.value <= unstunChance.Get(skillLevel)) { target.UCE_SetStun(unstunSeconds.Get(skillLevel)); } // -- check for skill cooldown if (modifyCooldownChance.Get(skillLevel) > 0) { for (int i = 0; i < target.skills.Count; ++i) { Skill skill = target.skills[i]; if (skill.IsOnCooldown() && UnityEngine.Random.value <= modifyCooldownChance.Get(skillLevel)) { skill.cooldownEnd += modifyCooldown.Get(skillLevel); target.skills[i] = skill; } } } // -- check for buff duration if (modifyBuffDurationChance.Get(skillLevel) > 0) { for (int i = 0; i < target.buffs.Count; ++i) { Buff buff = target.buffs[i]; if (buff.CheckBuffType(buffType) && buff.BuffTimeRemaining() > 0 && UnityEngine.Random.value <= modifyBuffDurationChance.Get(skillLevel)) { buff.buffTimeEnd += modifyBuffDuration.Get(skillLevel); target.buffs[i] = buff; } } } // ---------------------------------------------------------------- Experience if (caster is Player && hldHealth > 0) { if (expPerHealth > 0) { ((Player)caster).experience += (int)Mathf.Round(hldHealth * expPerHealth); } if (skillExpPerHealth > 0) { ((Player)caster).skillExperience += (int)Mathf.Round(hldHealth * skillExpPerHealth); } } // ---------------------------------------------------------------- Spawn Effect SpawnEffect(caster, target); } if (caster is Monster) { caster.target = null; } targets.Clear(); }
private void OnLevelUp_UCE_SkillExpOnLevelUp() { skillExperience += skillExpOnLevelUp.Get(level); }
private void OnLevelUp_UCE_SkillExpOnLevelUp() { ((PlayerSkills)skills).skillExperience += skillExpOnLevelUp.Get(level.current); }
// ----------------------------------------------------------------------------------- // Apply // ----------------------------------------------------------------------------------- public override void Apply(Entity caster, int skillLevel) { if (caster.target != null && caster.target.isAlive) { int oldHealth = caster.target.health; caster.target.health += healsHealth.Get(skillLevel); caster.target.mana += healsMana.Get(skillLevel); // -- check for unstun if (unstunChance.Get(skillLevel) > 0 && caster.target.UCE_Stunned() && UnityEngine.Random.value <= unstunChance.Get(skillLevel)) { caster.target.UCE_SetStun(unstunSeconds.Get(skillLevel)); } // -- check for skill cooldown if (modifyCooldownChance.Get(skillLevel) > 0) { for (int i = 0; i < caster.target.skills.Count; ++i) { Skill skill = caster.target.skills[i]; if (skill.IsOnCooldown() && UnityEngine.Random.value <= modifyCooldownChance.Get(skillLevel)) { skill.cooldownEnd += modifyCooldown.Get(skillLevel); caster.target.skills[i] = skill; } } } // -- check for buff duration if (modifyBuffDurationChance.Get(skillLevel) > 0) { for (int i = 0; i < caster.target.buffs.Count; ++i) { Buff buff = caster.target.buffs[i]; if (buff.CheckBuffType(buffType) && buff.BuffTimeRemaining() > 0 && UnityEngine.Random.value <= modifyBuffDurationChance.Get(skillLevel)) { buff.buffTimeEnd += modifyBuffDuration.Get(skillLevel); caster.target.buffs[i] = buff; } } } // -- check for experience gain on heal if (caster is Player) { if (expPerHealth > 0) { ((Player)caster).experience += (int)Mathf.Round((caster.target.health - oldHealth) * expPerHealth); } if (skillExpPerHealth > 0) { ((Player)caster).skillExperience += (int)Mathf.Round((caster.target.health - oldHealth) * skillExpPerHealth); } } SpawnEffect(caster, caster.target); Utils.InvokeMany(typeof(ScriptableSkill), this, "OnApply_", caster, skillLevel); } }
// ----------------------------------------------------------------------------------- // ApplyToTargets // ----------------------------------------------------------------------------------- public void ApplyToTargets(List <Entity> targets, Entity caster, int skillLevel) { //DamageType damageType = DamageType.Normal; // ---------------------------------------------------------- Apply to all targets foreach (Entity target in targets) { float buffModifier = 0; int dmg = 0; // ---------------------------------------------------------------- Debuff if (removeBuffType != BuffType.None || removeBuffs.Length > 0) { foreach (BuffSkill removeBuff in removeBuffs) { target.UCE_RemoveBuff(removeBuff, debuffChance.Get(skillLevel), buffModifier); } buffModifier = (debuffAddAccuracy) ? target.UCE_HarmonizeChance(0, caster.accuracy) : 0f; if (removeBuffType == BuffType.Buff) { target.UCE_CleanupStatusBuffs(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } else if (removeBuffType == BuffType.Nerf) { target.UCE_CleanupStatusNerfs(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } else if (removeBuffType == BuffType.Both) { target.UCE_CleanupStatusAny(debuffChance.Get(skillLevel), buffModifier, debuffAmount.Get(skillLevel)); } } // ---------------------------------------------------------------- Buff if (target.isAlive && applyBuffs.Length > 0) { buffModifier = (buffAddAccuracy) ? target.UCE_HarmonizeChance(0, caster.accuracy) : 0f; target.UCE_ApplyBuffs(applyBuffs, buffLevel.Get(skillLevel), buffChance.Get(skillLevel), buffModifier, buffAmount.Get(skillLevel)); } // ---------------------------------------------------------------- Effects // -- check for unstun if (unstunChance.Get(skillLevel) > 0 && target.UCE_Stunned() && UnityEngine.Random.value <= unstunChance.Get(skillLevel)) { target.UCE_SetStun(unstunSeconds.Get(skillLevel)); } // -- check for skill cooldown if (modifyCooldownChance.Get(skillLevel) > 0) { for (int i = 0; i < target.skills.Count; ++i) { Skill skill = target.skills[i]; if (skill.IsOnCooldown() && UnityEngine.Random.value <= modifyCooldownChance.Get(skillLevel)) { skill.cooldownEnd += modifyCooldown.Get(skillLevel); target.skills[i] = skill; } } } // -- check for buff duration if (modifyBuffDurationChance.Get(skillLevel) > 0) { for (int i = 0; i < target.buffs.Count; ++i) { Buff buff = target.buffs[i]; if (buff.CheckBuffType(buffType) && buff.BuffTimeRemaining() > 0 && UnityEngine.Random.value <= modifyBuffDurationChance.Get(skillLevel)) { buff.buffTimeEnd += modifyBuffDuration.Get(skillLevel); target.buffs[i] = buff; } } } // ---------------------------------------------------------------- Deal Damage dmg = damage.Get(skillLevel); if (addCasterDamage) { dmg += caster.damage; } caster.DealDamageAt(target, dmg, stunChance.Get(skillLevel), stunTime.Get(skillLevel)); // ---------------------------------------------------------------- Spawn Effect SpawnEffect(caster, target); } targets.Clear(); }