void Start() { duration = 3; InitialCreation(); CalculateAttackerStats(); if (wA.isTriggered && wA.targetPreference == null) { var temp = GameWorldReferenceClass.GetInAreaRootUnit(10, transform.position, wA.previousTargets); if (temp.Count > 0) { for (int i = 0; i < temp.Count; i++) { if (temp[i].unitID != wA.abilityOwner) { FaceNewTarget(temp[i].transform); i = temp.Count; } } } else { Obliterate(); } } else if (wA.isTriggered && wA.targetPreference != null) { } else { FaceOwnerTarget(); } }
public static void CalculateAbilityDefender(Guid DefenderID, WorldAbility Ability) { RootUnit unit = GameWorldReferenceClass.GetUnitByID(DefenderID).GetComponent <RootUnit>(); Type statsTF = unit.totalStats.GetType(); if (Ability.harmful) { float total = Ability.calculatedDamage; string form = Ability.wFormRune.formRuneType.ToString(); string school = Ability.wSchoolRune.schoolRuneType.ToString(); total += (float)statsTF.GetField(string.Format("{0}_DamageTaken_Flat", form)).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_DamageTaken_Flat", school)).GetValue(unit.totalStats); total *= 1 + (float)statsTF.GetField(string.Format("{0}_DamageTaken_AddPercent", form)).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_DamageTaken_AddPercent", school)).GetValue(unit.totalStats) + unit.totalStats.GlobalDamage_DamageTaken_AddPercent; total *= (float)statsTF.GetField(string.Format("{0}_DamageTaken_MultiplyPercent", form)).GetValue(unit.totalStats) * (float)statsTF.GetField(string.Format("{0}_DamageTaken_MultiplyPercent", school)).GetValue(unit.totalStats) * unit.totalStats.GlobalDamage_DamageTaken_MultiplyPercent; float resolvedDamage = Mathf.Round(total * 100) / 100; unit.unitHealth -= resolvedDamage; unit.ResolveHit(resolvedDamage, false); } if (Ability.helpful) { //DamageHitInfo hitInfo = new DamageHitInfo(); float resolvedHealing = Mathf.Round(Ability.calculatedHealing * 100) / 100; unit.unitHealth += resolvedHealing; unit.ResolveHeal(resolvedHealing); } }
public void Trigger() { List <RootUnit> targets = GameWorldReferenceClass.GetInAreaRootUnit(5f, transform.position, wA.previousTargets); TriggerParticleBurst(0); if (targets.Count > 0) { foreach (RootUnit target in targets) { if (target.unitID != wA.abilityOwner) { ApplyHit(target); if (wA.abilityToTrigger != null) { CreateTriggerAbility(target.transform.position, null); } } } Terminate(); } else { Terminate(); } }
public static void CalculateAbilityAttacker(WorldAbility Ability) { RootUnit unit = GameWorldReferenceClass.GetUnitByID(Ability.abilityOwner).GetComponent <RootUnit>(); Type statsTF = unit.totalStats.GetType(); RootUnit attacker = GameWorldReferenceClass.GetUnitByID(Ability.abilityOwner); if (Ability.harmful) { float total = Ability.wSchoolRune.Damage(); string form = Ability.wFormRune.formRuneType.ToString(); string school = Ability.wSchoolRune.schoolRuneType.ToString(); total += (float)statsTF.GetField(string.Format("{0}_Damage_Flat", form)).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_Damage_Flat", school)).GetValue(unit.totalStats); total *= 1 + (float)statsTF.GetField(string.Format("{0}_Damage_AddPercent", form)).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_Damage_AddPercent", school)).GetValue(unit.totalStats) + unit.totalStats.GlobalDamage_Damage_AddPercent; total *= (float)statsTF.GetField(string.Format("{0}_Damage_MultiplyPercent", form)).GetValue(unit.totalStats) * (float)statsTF.GetField(string.Format("{0}_Damage_MultiplyPercent", school)).GetValue(unit.totalStats) * unit.totalStats.GlobalDamage_Damage_MultiplyPercent; Ability.calculatedDamage = total; } if (Ability.helpful) { float total = Ability.wSchoolRune.Damage(); //total += (float)statsTF.GetField(string.Format("{0}_Damage_Flat", Ability.formRune.form.ToString())).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_Damage_Flat", Ability.schoolRunes[0].school.ToString())).GetValue(unit.totalStats); //total *= 1 + (float)statsTF.GetField(string.Format("{0}_Damage_AddPercent", Ability.formRune.form.ToString())).GetValue(unit.totalStats) + (float)statsTF.GetField(string.Format("{0}_Damage_AddPercent", Ability.schoolRunes[0].school.ToString())).GetValue(unit.totalStats); //total *= (float)statsTF.GetField(string.Format("{0}_Damage_MultiplyPercent", Ability.formRune.form.ToString())).GetValue(unit.totalStats) * (float)statsTF.GetField(string.Format("{0}_Damage_MultiplyPercent", Ability.schoolRunes[0].school.ToString())).GetValue(unit.totalStats); Ability.calculatedHealing = total; } }
public static void CalculateEnemyAbilityDefender(Guid DefenderID, float damage) { RootUnit defender = GameWorldReferenceClass.GetUnitByID(DefenderID); float resolvedDamage = Mathf.Round(damage * 100) / 100; defender.unitHealth -= resolvedDamage; defender.ResolveHit(resolvedDamage, false); }
public bool DropItem(InventoryItem itemToRemove, int index) { if (RemoveItem(index)) { WorldItem tempItem = new WorldItem(); tempItem.inventoryItem = itemToRemove; GameObject.Instantiate(tempItem, GameWorldReferenceClass.GetUnitByID(owner).transform.position, new Quaternion()); return(true); } return(false); }
public void Trigger() { var owner = GameWorldReferenceClass.GetUnitByID(wA.abilityOwner); TriggerParticleBurst(0); ApplyHit(owner); if (wA.abilityToTrigger != null) { CreateTriggerAbility(transform.position, null); } Terminate(); }
void Start() { duration = 1; InitialCreation(); CalculateAttackerStats(); bC = GetComponent <BoxCollider>(); weaponModel = GameWorldReferenceClass.GetUnitByID(wA.abilityOwner).mainhandWeapon; transform.position = weaponModel.position; transform.rotation = weaponModel.rotation; bC.center = weaponModel.GetComponent <BoxCollider>().center; bC.size = weaponModel.GetComponent <BoxCollider>().size; }
public void PositionAtOwnerTarget() { Physics.Raycast(GameWorldReferenceClass.GW_PlayerCamera.transform.position, GameWorldReferenceClass.GW_PlayerCamera.transform.forward, out camRay, 100, ~(1 << 11 | 1 << 12)); Physics.Raycast(GameWorldReferenceClass.GetUnitByID(wA.abilityOwner).primarySpellCastLocation.position, camRay.point - GameWorldReferenceClass.GetUnitByID(wA.abilityOwner).primarySpellCastLocation.position, out spellRay, 100, ~(1 << 11 | 1 << 12)); if (camRay.collider != null) { transform.position = spellRay.point; } else { transform.position = GameWorldReferenceClass.GW_PlayerCamera.transform.position + GameWorldReferenceClass.GW_PlayerCamera.transform.forward * 1000; } }
void Start() { duration = 15; InitialCreation(); CalculateAttackerStats(); height = GameWorldReferenceClass.GetUnitByID(wA.abilityOwner).size; var particleShape = pS.shape; particleShape.scale = new Vector3(radius, radius, height); var particleEmission = pS.emission; particleEmission.rateOverTime = new ParticleSystem.MinMaxCurve(particleEmission.rateOverTime.constant * radius * 2); PositionAtOwner(); }
public override void Effect(RootUnit target, RootUnit owner, WorldAbility worldAbility) { Collider[] collisionSphere; collisionSphere = Physics.OverlapSphere(owner.primarySpellCastLocation.position, 2, 1 << 11); foreach (var item in collisionSphere) { var ability = item.GetComponent <EnemyWorldAbility>(); if (ability != null && ability.enemyAbilityStats.behavior == EnemyAbilityStats.Behavior.Projectile) { ability.reflected = true; item.transform.LookAt(GameWorldReferenceClass.GetUnitByID(ability.enemyAbilityStats.owner).transform.position); } } }
public void Trigger() { List <RootUnit> targets = GameWorldReferenceClass.GetInAreaRootUnit(.1f, transform.position, wA.previousTargets); Vector3 lastPos; if (targets.Count > 0) { wA.previousTargets.Add(targets[0]); ChainGang.Add(targets[0]); lastPos = targets[0].transform.position; TriggerParticleBurst(0); for (int jumps = 0; jumps < chainTargets; jumps++) { targets = GameWorldReferenceClass.GetInAreaRootUnit(8f, lastPos, wA.previousTargets).ToList(); for (int i = 0; i < targets.Count; i++) { if (targets[i].unitID != wA.abilityOwner) { wA.previousTargets.Add(targets[i]); ChainGang.Add(targets[i]); lastPos = targets[i].transform.position; transform.position = lastPos; TriggerParticleBurst(0); i = targets.Count; } } } foreach (RootUnit target in ChainGang) { ApplyHit(target); if (wA.abilityToTrigger != null) { CreateTriggerAbility(target.transform.position, null); } } Terminate(); } else { Terminate(); } }
void Start() { duration = 15; InitialCreation(); CalculateAttackerStats(); PositionAtOwnerTarget(); transform.position += new Vector3(0, 1, 0); var someNew = GameWorldReferenceClass.GetInAreaRootUnit(25, transform.position, wA.previousTargets); for (int i = 0; i < someNew.Count; i++) { if (someNew[i].unitID != wA.abilityOwner) { wA.targetPreference = someNew[i].transform; i = someNew.Count; } } }
public void ApplyHit(RootUnit target) { if ((target.unitID == wA.abilityOwner && wA.harmful && wA.selfHarm) || target.unitID != wA.abilityOwner) { DamageManager.CalculateAbilityDefender(target.unitID, wA); } if (wA.wEffectRunes != null) { foreach (var rune in wA.wEffectRunes) { if (rune.triggerTag == Rune.TriggerTag.OnHit) { rune.Effect(target, GameWorldReferenceClass.GetUnitByID(wA.abilityOwner), wA); } } } }
public void Trigger() { List <RootUnit> targets = GameWorldReferenceClass.GetInAreaRootUnit(.1f, transform.position, wA.previousTargets); TriggerParticleBurst(0); if (targets.Count > 0) { ApplyHit(targets[0]); wA.previousTargets.Add(targets[0]); if (wA.abilityToTrigger != null) { CreateTriggerAbility(transform.position, null); } Terminate(); } else { Terminate(); } }
public bool TossItem(InventoryItem itemToRemove, int index) { if (RemoveItem(index)) { RootUnit unitToDrop = GameWorldReferenceClass.GetUnitByID(owner); Vector3 pos = unitToDrop.transform.position; if (ResourceManager.AllWorldItems.Count > 0) { WorldItem itemBeingCreated = ResourceManager.RestoreItem(); itemBeingCreated.inventoryItem = itemToRemove; itemBeingCreated.transform.position = new Vector3(UnityEngine.Random.Range(-.25f, .25f) + pos.x, .25f + pos.y, UnityEngine.Random.Range(-.25f, .25f) + pos.z); itemBeingCreated.transform.LookAt(unitToDrop.transform); itemBeingCreated.transform.Rotate(0, 180, 0); itemBeingCreated.GetComponent <Rigidbody>().velocity = itemBeingCreated.transform.forward * UnityEngine.Random.Range(4f, 7f); itemBeingCreated.transform.rotation = UnityEngine.Random.rotation; itemBeingCreated.transform.SetParent(GameObject.Find("Items").transform); itemBeingCreated.gameObject.SetActive(true); return(true); } else { GameObject freshWorldItem = GameObject.Instantiate(Resources.Load("BlankItem")) as GameObject; WorldItem itemBeingCreated = freshWorldItem.GetComponent <WorldItem>(); itemBeingCreated.inventoryItem = itemToRemove; itemBeingCreated.transform.position = new Vector3(UnityEngine.Random.Range(-.25f, .25f) + unitToDrop.transform.position.x, .25f + unitToDrop.transform.position.y, UnityEngine.Random.Range(-.25f, .25f) + unitToDrop.transform.position.z); itemBeingCreated.transform.LookAt(unitToDrop.transform); itemBeingCreated.transform.Rotate(0, 180, 0); itemBeingCreated.GetComponent <Rigidbody>().velocity = itemBeingCreated.transform.forward * UnityEngine.Random.Range(4f, 7f); itemBeingCreated.transform.rotation = UnityEngine.Random.rotation; freshWorldItem.transform.SetParent(GameObject.Find("Items").transform); return(true); } } return(false); }
public override void Effect(RootUnit target, RootUnit owner, WorldAbility worldAbility) { GameWorldReferenceClass.CreateWorldAbility(target, owner, worldAbility, 10); }
public void PlayerUnitStart() { CreateInitial(); LearnAbilities(); FillHotBar(); GameWorldReferenceClass.LearnAllRunes(); var thing1 = ItemFactory.CreateEquipment("BasicVambrace", "Arm_Lower"); charInventory.AddItem(thing1); var thing2 = ItemFactory.CreateEquipment("BasicVambrace", "Arm_Lower"); charInventory.AddItem(thing2); var thing3 = ItemFactory.CreateEquipment("BasicRerebrace", "Arm_Upper"); charInventory.AddItem(thing3); var thing4 = ItemFactory.CreateEquipment("BasicRerebrace", "Arm_Upper"); charInventory.AddItem(thing4); var thing5 = ItemFactory.CreateEquipment("BasicCloak", "Back"); charInventory.AddItem(thing5); var thing6 = ItemFactory.CreateEquipment("BasicBreastplate", "Chest"); charInventory.AddItem(thing6); var thing7 = ItemFactory.CreateEquipment("BasicSabaton", "Foot"); charInventory.AddItem(thing7); var thing8 = ItemFactory.CreateEquipment("BasicSabaton", "Foot"); charInventory.AddItem(thing8); var thing9 = ItemFactory.CreateEquipment("BasicGauntlet", "Hand"); charInventory.AddItem(thing9); var thing10 = ItemFactory.CreateEquipment("BasicGauntlet", "Hand"); charInventory.AddItem(thing10); var thing11 = ItemFactory.CreateEquipment("BasicHelm", "Head"); thing11.attatchedAbility.NameSelf(); thing11.attatchedAbility.EffectFromInspector(); charInventory.AddItem(thing11); var thing12 = ItemFactory.CreateEquipment("BasicGreave", "Leg_Lower"); charInventory.AddItem(thing12); var thing13 = ItemFactory.CreateEquipment("BasicGreave", "Leg_Lower"); charInventory.AddItem(thing13); var thing14 = ItemFactory.CreateEquipment("BasicCuisse", "Leg_Upper"); charInventory.AddItem(thing14); var thing15 = ItemFactory.CreateEquipment("BasicCuisse", "Leg_Upper"); charInventory.AddItem(thing15); var thing16 = ItemFactory.CreateEquipment("BasicAmulet", "Neck"); charInventory.AddItem(thing16); var thing17 = ItemFactory.CreateEquipment("BasicPauldron", "Shoulder"); charInventory.AddItem(thing17); var thing18 = ItemFactory.CreateEquipment("BasicPauldron", "Shoulder"); charInventory.AddItem(thing18); var thing19 = ItemFactory.CreateEquipment("BasicFaulds", "Waist"); charInventory.AddItem(thing19); var thing20 = ItemFactory.CreateEquipment("BasicSword", "Weapon"); charInventory.AddItem(thing20); var thing21 = ItemFactory.CreateEquipment("BasicSword", "Weapon"); charInventory.AddItem(thing21); }
public void FindTarget() { currentTarget = GameWorldReferenceClass.GetInAreaPlayer(20, transform.position); }
public void PositionAtOwnerCastLocation() { transform.position = GameWorldReferenceClass.GetUnitByID(wA.abilityOwner).primarySpellCastLocation.position; }