public static void CreateDamageZone(Character character, GameObject gameObject, AttackAbility ability, float radius, string faction) { var obj = GameObject.Instantiate(character.GetComponent <CacheGrabber>().damageZones[ability.aoe], gameObject.transform.position, gameObject.transform.rotation); obj.transform.Rotate(-90f, 0f, 0f); obj.GetComponent <DamageZoneDealDamage>().size = radius; var damageZoneDealDamage = obj.GetComponent <DamageZoneDealDamage>(); if (damageZoneDealDamage != null) { damageZoneDealDamage.ability = ability; damageZoneDealDamage.character = character; damageZoneDealDamage.faction = faction; } var noises = new Dictionary <Element, string>() { { Element.acid, "sfx_acid_damage_aoe" }, { Element.bashing, "sfx_bashing_damage1" }, { Element.fire, "sfx_fire_damage_aoe2" }, { Element.ice, "sfx_ice_damage_aoe1" }, { Element.none, "sfx_bashing_damage1" }, { Element.piercing, "sfx_bashing_damage1" }, { Element.slashing, "sfx_slashing_damage1" }, { Element.light, "sfx_holy_damage_aoe1" }, { Element.dark, "sfx_profane_damage_aoe1" } }; var noise = ""; if (noises.ContainsKey(ability.element)) { noise = noises[ability.element]; } if (noise != "") { MakeNoiseByName(noise, 32, gameObject, character); } }
public static void CreateAoe(Character character, GameObject gameObject, AttackAbility ability, List <AbilityAttribute> attributes, int damage, float radius, string faction) { var obj = GameObject.Instantiate(character.GetComponent <CacheGrabber>().aoes[ability.aoe], gameObject.transform.position, gameObject.transform.rotation); obj.GetComponent <AOEDealDamage>().size = radius; var ps = obj.GetComponentInChildren <ParticleSystem>(); if (ps != null) { var main = ps.main; main.startSize = radius; ps.Play(); } obj.GetComponent <AOEDealDamage>().Initialize(damage, radius, attributes, faction, character, ability); var noises = new Dictionary <Element, string>() { { Element.acid, "sfx_acid_damage_aoe" }, { Element.bashing, "sfx_bashing_damage1" }, { Element.fire, "sfx_fire_damage_aoe2" }, { Element.ice, "sfx_ice_damage_aoe1" }, { Element.none, "sfx_bashing_damage1" }, { Element.piercing, "sfx_bashing_damage1" }, { Element.slashing, "sfx_slashing_damage1" }, { Element.light, "sfx_holy_damage_aoe1" }, { Element.dark, "sfx_profane_damage_aoe1" } }; var noise = ""; if (noises.ContainsKey(ability.element)) { noise = noises[ability.element]; } if (noise != "") { MakeNoiseByName(noise, 32, gameObject, character); } }
private static float GetSpeedMinus(AttackAbility ability, AbilityAttribute attribute) { var degree = (float)attribute.FindParameter("degree").value; var duration = (float)attribute.FindParameter("duration").value; return(ability.points * degree / 10f * duration); }
public void ApplyEffectsFromAttack(Character attacker, AttackAbility ability, float damage, Transform projectileTransform) { Dictionary <string, Effect> effects = SetUpEffectDictionary(attacker, ability, damage, projectileTransform); int count = 0; foreach (var attribute in ability.attributes) { if (effects.ContainsKey(attribute.type) && attribute.priority >= 50 && count < 4) { effects[attribute.type](attribute); } count++; } if (attacker != null && attacker.GetComponent <AbilityUser>().HasPassive("knockback")) { AbilityEffects.KnockbackDefault(attacker, GetComponent <Character>()); } if (attacker != null && attacker.GetComponent <AbilityUser>().HasPassive("pullEnemies")) { AbilityEffects.PullTowardsDefault(attacker, GetComponent <Character>()); } if (ability.FindAttribute("createDamageZone") == null && ability.dotDamage > 0) { GetComponent <StatusEffectHost>().AddStatusEffect("dot", ability.dotTime, degree: ability.CalculateDotDamage(attacker), inflicter: attacker, ability: ability); } }
//public AbilityHyperDash abilityHyperDash; // Use this for initialization void Start() { //Physics.gravity = new Vector3 (0, 0, -9.81f); anim = GetComponent <Animator> (); basicMovement = GetComponent <AbilityBasicMovement> (); attackAbility = GetComponent <AttackAbility> (); shieldAbility = GetComponent <AbilityShield> (); dodgeAbility = GetComponent <AbilityDodgeRoll> (); sprintAttackAbility = GetComponent <AbilitySprintAttack> (); chargedAttackAbility = GetComponent <AbilityChargedAttack> (); warpStrikeAbility = GetComponent <AbilityWarpStrike>(); grabAbility = GetComponent <AbilityGrab> (); flinchState = GetComponent <PlayerStateFlinch> (); fallState = GetComponent <AbilityFall> (); interactState = GetComponent <AbilityInteract> (); dialogueState = GetComponent <AbilityDialogue> (); hurtInfo = GetComponent <HurtInfoReceiver> (); playerHealthComponent = GetComponent <PlayerHealthComponent>(); //abilityHyperDash = GetComponent<AbilityHyperDash> (); //If Player doesn't exist yet if (!playerExists) { playerExists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } //Starting state for player playerState = PlayerState.Default; }
public static string Describe(AttackAbility ability) { string description = GetTopDescription(ability); int count = 0; foreach (var attribute in ability.attributes) { if (attribute.priority < 50 || count > 3) { description += "LATENT - "; } if (simpleDescriptionTable.ContainsKey(attribute.type)) { description += simpleDescriptionTable[attribute.type]; } else if (descriptionTable.ContainsKey(attribute.type)) { description += descriptionTable[attribute.type](ability, attribute); } else { description += attribute.type + " - DESCRIPTION NOT FOUND.\n"; } count++; } return(description); }
public override Ability Copy() { var newAbility = new AttackAbility { name = name, description = description, damage = damage, element = element, baseStat = baseStat, icon = icon, dotDamage = dotDamage, dotTime = dotTime, isRanged = isRanged, rangedProjectile = rangedProjectile, cooldown = cooldown, currentCooldown = currentCooldown, mpUsage = mpUsage, baseMpUsage = baseMpUsage, radius = radius, hitEffect = hitEffect, aoe = aoe, points = points }; foreach (var attribute in attributes) { newAbility.attributes.Add(attribute.Copy()); } return(newAbility); }
public static AbilityAttribute Generate(AttackAbility ability, string attributeType) { for (int i = 0; i < 10000; i++) { AbilityAttribute attribute; if (simpleAttributes.Contains(attributeType)) { attribute = new AbilityAttribute { type = attributeType }; attribute.priority = UnityEngine.Random.Range(12.5f, 100f); attribute.points = AbilityAttributeAppraiser.Appraise(ability, attribute); if (negativeAttributes.Contains(attribute.type) && attribute.priority < 50) { continue; } return(attribute); } attribute = attributes[attributeType](ability); if (attribute != null) { attribute.priority = UnityEngine.Random.Range(12.5f, 100f); attribute.points = AbilityAttributeAppraiser.Appraise(ability, attribute); if (negativeAttributes.Contains(attribute.type) && attribute.priority < 50) { continue; } return(attribute); } } Debug.Log("FAILED TO FIND VALID ATTRIBUTE FOR ABILITY!"); return(null); }
public void CheckReduceMpUsageReducesMpUsage() { var ability = new AttackAbility { baseMpUsage = 40, mpUsage = 40, attributes = new List <AbilityAttribute>(), damage = 1f, dotDamage = 0f, dotTime = 0f, element = Element.bashing, isRanged = true, level = 1, points = 70f, radius = 0, xp = 0 }; var skillTreeNode = new AbilitySkillTreeNode(ability, new List <AbilitySkillTreeNode>()); skillTreeNode.effects.Add(new SoulGemEnhancement { type = "reduceMpUsage", effect = -5 }); skillTreeNode.Activate(); Assert.Less(ability.mpUsage, 40); Assert.Less(ability.baseMpUsage, 40); }
private void UseMeleeAttack(AttackAbility ability, float damage, float calculatedDamage) { if (ability == null && GetComponent <AbilityUser>().GCDTime > 0) { return; } GetComponent <AbilityUser>().GCDTime = AbilityUser.maxGCDTime; if (ability.FindAttribute("offGCD") != null) { GetComponent <AbilityUser>().GCDTime = 0f; } if ((ability.FindAttribute("chargeTowards") != null && ability.FindAttribute("chargeTowards").priority >= 50) || GetComponent <AbilityUser>().HasPassive("charge")) { ChargeTowards(); } if (ability.FindAttribute("createDamageZone") != null) { CreateMeleeDamageZone(ability); } else if (ability.radius > 0) { HitAllInRadius((int)calculatedDamage, ability.radius, ability); } else { meleeAttackAbility = ability; meleeAttackDamage = calculatedDamage; StartCoroutine(ActivateMeleeHitbox()); } }
public static int Select(AttackAbility ability) { int count = 0; foreach (var attribute in ability.attributes) { if (attribute.priority < 50 || count > 3) { break; } if (simpleIconTable.ContainsKey(attribute.type)) { return(simpleIconTable[attribute.type]); } count++; } if (ability.radius > 0) { return(basicAoeIcons[ability.element]); } else if (ability.isRanged) { return(basicRangedIcons[ability.element]); } else { return(basicMeleeIcons[ability.element]); } }
public static SavedAttackAbility ConvertAttackFrom(AttackAbility ability) { var obj = new SavedAttackAbility { icon = ability.icon, cooldown = ability.cooldown, mpUsage = ability.mpUsage, baseMpUsage = ability.baseMpUsage, radius = ability.radius, name = ability.name, description = ability.description, baseStat = ability.baseStat, damage = ability.damage, dotDamage = ability.dotDamage, dotTime = ability.dotTime, element = ability.element, isRanged = ability.isRanged, rangedProjectile = ability.rangedProjectile, hitEffect = ability.hitEffect, aoe = ability.aoe, points = ability.points, xp = ability.xp, level = ability.level, skillPoints = ability.skillPoints, skillTree = SavedSkillTree.ConvertFrom(ability.skillTree) }; foreach (var attribute in ability.attributes) { obj.attributes.Add(SavedAbilityAttribute.ConvertFrom(attribute)); } return(obj); }
private static string SpeedMinusDescription(AttackAbility ability, AbilityAttribute attribute) { var degree = (int)(((float)attribute.FindParameter("degree").value) * 100f); var duration = (float)attribute.FindParameter("duration").value; return("Slow target's movement by " + degree.ToString() + "% for " + Mathf.FloorToInt(duration).ToString() + " seconds.\n"); }
private static AbilityAttribute GetAddedDot(AttackAbility ability) { int roll = UnityEngine.Random.Range(0, 4); var dotDurations = new List <float> { 4f, 8f, 8f, 12f }; var dotMultipliers = new List <float> { 1.5f, 3f, 3f, 4f }; var dotDuration = dotDurations[roll]; var dotMultiplier = dotMultipliers[roll]; return(new AbilityAttribute { type = "addedDot", parameters = new List <AbilityAttributeParameter> { new AbilityAttributeParameter { name = "degree", value = AttackAbilityGenerator.CalculateDamage(ability.points * 0.5f * dotMultiplier) }, new AbilityAttributeParameter { name = "duration", value = dotDuration } } }); }
private void FireIndividualSpreadProjectile(AttackAbility ability, float damage, float calculatedDamage, float currentAngle) { var obj = Instantiate(GetComponent <CacheGrabber>().projectiles[ability.rangedProjectile], new Vector3(transform.position.x, transform.position.y + 0.5f, transform.position.z), transform.rotation); obj.transform.Rotate(0, currentAngle, 0); obj.GetComponentInChildren <RangedHitboxDealDamage>().Initialize(GetComponent <Character>(), (int)calculatedDamage, ability.attributes, ability.radius, damage * ability.dotDamage, ability.dotTime, GetComponent <Character>().faction, ability); //NetworkServer.Spawn(obj); }
private void UseBossCircleAoe(AttackAbility ability, float damage, float calculatedDamage) { var player = GetRandomPlayer(); var obj = Instantiate(bossCircleAoePrefab, player.transform.position, bossCircleAoePrefab.transform.rotation); obj.GetComponent <TelegraphedAoe>().Initialize(ability, calculatedDamage, gameObject); //NetworkServer.Spawn(obj); }
private void UseBossHomingProjectile(AttackAbility ability, float damage, float calculatedDamage) { var player = GetRandomPlayer(); var obj = Instantiate(homingProjectilePrefab, transform.position, Quaternion.LookRotation(player.transform.position - transform.position)); obj.GetComponent <HomingProjectile>().Initialize(GetComponent <Character>(), ability, calculatedDamage, player); //NetworkServer.Spawn(obj); }
private GameObject GetDotVisual(AttackAbility ability, Character inflicter) { if (dotSpellEffects.ContainsKey(ability.element)) { return(Instantiate(rawStatusEffects[dotSpellEffects[ability.element]])); } return(null); }
private static void ModifyAttackAbilityPointsForQualities(AttackAbility ability) { ability.points *= AbilityCalculator.pointsMultiplierByBaseStat[ability.baseStat]; ability.points *= AbilityCalculator.pointsMultiplierByRadius[ability.radius]; ability.points *= AbilityCalculator.pointsMultiplierByDotTime[ability.dotTime]; ability.points *= AbilityCalculator.pointsMultiplierByCooldown[ability.cooldown]; ability.points *= AbilityCalculator.pointsMultiplierByMpUsage[(int)ability.baseMpUsage]; }
public void Initialize(int damage, float radius, List <AbilityAttribute> attributes, string faction, Character character, AttackAbility ability) { this.damage = damage; this.radius = radius; this.attributes = attributes; this.faction = faction; this.character = character; this.ability = ability; }
private void CreateMeleeDamageZone(AttackAbility ability) { var obj = Instantiate(GetComponent <CacheGrabber>().damageZones[ability.aoe], transform.position, transform.rotation); obj.transform.Rotate(-90f, 0f, 0f); obj.transform.localScale *= ability.radius; obj.GetComponent <DamageZoneDealDamage>().Initialize(ability, GetComponent <Character>(), GetComponent <Character>().faction); //NetworkServer.Spawn(obj); }
private void UseBossLineAoe(AttackAbility ability, float damage, float calculatedDamage) { var player = GetRandomPlayer(); var obj = Instantiate(bossLineAoePrefab, (transform.position + player.transform.position) / 2, Quaternion.LookRotation(player.transform.position - transform.position)); obj.transform.Rotate(0, 90, 0); obj.GetComponent <TelegraphedAoe>().Initialize(ability, calculatedDamage, gameObject); //NetworkServer.Spawn(obj); }
public void MeleeHitboxOff() { isAttacking = false; GetComponent <AnimationController>().SetAttacking(false); if (meleeAttackAbility != null) { meleeAttackAbility = null; GetComponent <Character>().CalculateAll(); } }
private void GenerateCooldownAbility() { AttackAbility ability = null; while (ability == null || ability.cooldown == 0 || WrongStat(ability) || ability.mpUsage > maxMpAvailable) { ability = AttackAbilityGenerator.Generate(); } attackAbilities2.Add(ability); }
private void ShowHitVisual(AttackAbility ability) { if (ability != null && !ability.isRanged) { GetComponent <ObjectSpawner>().CmdSpawnWithPosition(GetComponent <CacheGrabber>().hitEffects[ability.hitEffect], transform.position, transform.rotation); } else if (ability == null) { GetComponent <ObjectSpawner>().CmdSpawnWithPosition(GetComponent <CacheGrabber>().hitEffects[1], transform.position, transform.rotation); } }
public void Initialize(Character character, AttackAbility ability, float damage, GameObject player) { this.player = player; agent = GetComponent <NavMeshAgent>(); agent.destination = player.transform.position; agent.speed = 20; agent.angularSpeed = 120; var rhdd = GetComponentInChildren <RangedHitboxDealDamage>(); rhdd.Initialize(character, (int)damage, ability.attributes, 0, 0, 0, "Enemy", ability); }
private static AbilityAttribute GetDelay(AttackAbility ability) { return(new AbilityAttribute { type = "delay", parameters = new List <AbilityAttributeParameter> { new AbilityAttributeParameter { name = "time", value = 4f } } }); }
private static AbilityAttribute GetDamageShield(AttackAbility ability) { return(new AbilityAttribute { type = "damageShield", parameters = new List <AbilityAttributeParameter> { new AbilityAttributeParameter { name = "degree", value = ability.points * 0.5f / 32f } } }); }
private static AbilityAttribute GetRestoreMP(AttackAbility ability) { return(new AbilityAttribute { type = "restoreMP", parameters = new List <AbilityAttributeParameter> { new AbilityAttributeParameter { name = "degree", value = ability.points / 70f * 40f } } }); }
private static AbilityAttribute GetBackstab(AttackAbility ability) { return(new AbilityAttribute { type = "backstab", parameters = new List <AbilityAttributeParameter> { new AbilityAttributeParameter { name = "degree", value = 4f } } }); }
void Start() { PlayerOne = GameObject.Find ("PlayerOne"); PlayerTwo = GameObject.Find ("PlayerTwo"); // Add Abilities Freeze = GetComponent<FreezeAbility>(); Dash = GetComponent<DashAbility>(); Block = GetComponent<BlockAbility>(); Bomb = GetComponent<BombAbility>(); Attack = GetComponent<AttackAbility>(); // Grant abilties GiveAllAbilities (); }