public override bool OnCheckUseOnTarget(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { if (caster.Controllers.VitalityController.HasEnergy(EnergyType, EnergyCost) && target is Fury.Behaviors.Unit) return true; return false; }
/// <summary> /// Finish casting the ability, damage units in the ability's area of effect. /// </summary> public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { // Reduce the caster's energy caster.ModifyEnergy(EnergyType, -EnergyCost); // Iterate through all unfriendly commanders foreach (var cmdr in Fury.Behaviors.Manager.Instance.Commanders) if (!caster.IsTeamOrNeutral(cmdr)) // Iterate through all units of unfriendly commanders foreach (var unit in cmdr.Units.Values) // Check if unit is inside the radius if (Vector3.Distance(unit.transform.position, position) < Radius) { // Damage the unit unit.ModifyHealth(-Damage, caster, this); // Apply status effect if set if (StatusEffect != null) unit.AddStatus(StatusEffect, caster); } // Create an effect where the ability is used if (Effect != null) { var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect); effect.transform.position = position; } }
public override void OnTokenStackStateChanged(Fury.Behaviors.Stack stack, byte index, short oldVal, short newVal) { if (newVal < oldVal) { (stack.Owner as Fury.Behaviors.Unit).ModifyEnergy(EnergyType, ReplenishAmount); } }
public static ICelestialObject GenerateNpcShip(GameSession gameSession, int spaceShipClass, int spaceShipType, int standing) { Logger.Debug($"[CelestialObjectsFactory][GenerateNpcShip] Start generate."); var spaceship = gameSession.GetPlayerSpaceShip().ToSpaceship(); Spaceship newCelestialObject = null; switch (spaceShipType) { case 12: newCelestialObject = Fury.Generate(); break; default: break; } if (newCelestialObject != null) { newCelestialObject.PositionX = spaceship.PositionX + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.PositionY = spaceship.PositionY + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.Speed = newCelestialObject.MaxSpeed; newCelestialObject.Direction = SpaceMapTools.GetAngleBetweenPoints(newCelestialObject.GetLocation().ToVector2(), spaceship.GetLocation().ToVector2()); } return(newCelestialObject); }
public override void OnTokenStackStateChanged(Fury.Behaviors.Stack stack, byte index, short oldVal, short newVal) { var unit = stack.Owner as Fury.Behaviors.Unit; if (index == 0 && newVal > 0) { var compos = unit.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (var smr in compos) if (smr.name == ItemModel) { smr.enabled = true; } else if (smr.name.Contains(ItemGroup)) { smr.enabled = false; } } else if (index == 0 && newVal == 0) { var compos = unit.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (var smr in compos) if (smr.name == ItemModel) { smr.enabled = false; } else if (smr.name == "base" + ItemGroup) { smr.enabled = true; } } }
public static ICelestialObject GenerateNpcShip(GameSession gameSession, int spaceShipClass, int spaceShipType, int standing) { var spaceship = gameSession.GetPlayerSpaceShip().ToSpaceship(); Spaceship newCelestialObject = null; switch (spaceShipType) { case 12: newCelestialObject = Fury.Generate(); break; default: break; } if (newCelestialObject != null) { newCelestialObject.PositionX = spaceship.PositionX + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.PositionY = spaceship.PositionY + Math.Abs(500 + RandomGenerator.GetInteger(-20, 20)); newCelestialObject.Speed = newCelestialObject.MaxSpeed; newCelestialObject.Direction = GeometryTools.Azimuth(spaceship.GetLocation(), newCelestialObject.GetLocation()); } return(newCelestialObject); }
public override void OnTokenStackStateChanged(Fury.Behaviors.Stack stack, byte index, short oldVal, short newVal) { if (newVal < oldVal) { (stack.Owner as Fury.Behaviors.Unit).ModifyHealth(ReplenishAmount, null, this); } }
public override void OnAttackComplete(Fury.Behaviors.Unit attacker, Fury.Behaviors.Unit target) { // Our attack damage is based on strength var totalStr = 0; foreach (var stack in attacker.Controllers.TokenController.Stacks) if (stack.Token is Equipment && stack.States[0] > 0) totalStr += (stack.Token as Equipment).Strength; target.ModifyHealth(-(Damage + totalStr), attacker, this); }
public override void OnAttackComplete(Fury.Behaviors.Unit attacker, Fury.Behaviors.Unit target) { var arrow = (GameObject)GameObject.Instantiate(ArrowPrefab); var projectile = arrow.AddComponent<Projectile>(); projectile.FlightDuration = Vector3.Distance(attacker.transform.position, target.transform.position) / Speed; projectile.StartPoint = attacker.transform.FindChild("-turret").position; projectile.WeaponSource = this; projectile.AttackingUnit = attacker; projectile.TargetUnit = target; }
private void OnUnitDead(Fury.Behaviors.Unit deadUnit, Fury.Behaviors.Unit lastAttacker) { if (Creeps.Exists(i => i == deadUnit.Identifier)) { Creeps.Remove(deadUnit.Identifier); SpawnLoot(deadUnit.transform.position); StartCoroutine("QueueSpawn"); StartCoroutine("CleanSpawn", deadUnit.gameObject); } }
public override void OnDead(Fury.Behaviors.Unit corpse, Fury.Behaviors.Unit killer) { if (RubblePrefab != null) { var rubble = (GameObject)GameObject.Instantiate(RubblePrefab); rubble.transform.position = corpse.transform.position; } if (CratePrefab != null && LootTable != null) { var crate = Fury.Behaviors.Manager.Instance.CreateDeposit(CratePrefab, corpse.transform.position, null); foreach (var item in LootTable) crate.CreateTokenStack(item, new[] { (Byte)1 }); } GameObject.Destroy(corpse.gameObject); }
public override void OnDead(Fury.Behaviors.Unit corpse, Fury.Behaviors.Unit killer) { var colliders = corpse.GetComponentsInChildren<Collider>(); foreach (var collider in colliders) { if (collider != corpse.collider) { collider.enabled = true; var body = collider.gameObject.AddComponent<Rigidbody>(); body.WakeUp(); body.AddExplosionForce(1f, Vector3.zero, 0.1f); } } GameObject.Destroy(corpse.collider); }
public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, Vector3 position) { var stats = GameObject.Find("PlayerStatsObject"); var playerStats = stats.GetComponent<PlayerStats>(); if (playerStats != null && playerStats.HasInInventory(Buyables.SolarPanelFactory)) { GameObject clone = Instantiate(this.solarPanelFactory, new Vector3(position.x + 0.0F, position.y + 5F, position.z + 0.0F), new Quaternion(-45, 0, 0, 0)) as GameObject; var solarPanelFactory = playerStats.AddSolarPanelFactory(clone); var collisionManager = clone.GetComponent<CollisionManager>(); collisionManager.Buildable = solarPanelFactory; playerStats.UpdateAmountInInventory(Buyables.SolarPanelFactory, -1); } }
public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, Vector3 position) { var stats = GameObject.Find("PlayerStatsObject"); var playerStats = stats.GetComponent<PlayerStats>(); if (playerStats != null && playerStats.HasInInventory(Buyables.MineralExtractor)) { GameObject clone = Instantiate(this.OxygenExtractor, new Vector3(position.x + 0.0F, position.y + 1F, position.z + 0.0F), new Quaternion(0, 0, 0, 0)) as GameObject; var mineral = playerStats.AddMineralExtractor(clone); var collisionManager = clone.GetComponent<CollisionManager>(); collisionManager.Buildable = mineral; playerStats.UpdateAmountInInventory(Buyables.MineralExtractor, -1); } }
public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { var totalInt = 0; foreach (var stack in caster.Controllers.TokenController.Stacks) if (stack.Token is Equipment && stack.States[0] > 0) totalInt += (stack.Token as Equipment).Intelligence; (target as Fury.Behaviors.Unit).ModifyHealth(-(Damage + totalInt), caster, this); caster.ModifyEnergy(EnergyType, -EnergyCost); if (Effect != null) { var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect); effect.transform.position = target.transform.position; } if (StatusEffect != null) (target as Fury.Behaviors.Unit).AddStatus(StatusEffect, caster); }
public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { var targetDeposit = target as Fury.Behaviors.Deposit; foreach (var tokenStack in targetDeposit.Controllers.TokenController.Stacks) { var lootingHandled = false; foreach(var existingStack in caster.Controllers.TokenController.Stacks) if (existingStack.Token == tokenStack.Token && tokenStack.Token is Consumable) { caster.ModifyTokenStackState(existingStack, 0, (Byte)Math.Min(existingStack.States[0] + tokenStack.States[0], 255)); lootingHandled = true; } if (!lootingHandled) caster.CreateTokenStack(tokenStack.Token, tokenStack.States.ToArray()); } targetDeposit.Kill(); }
static void Main(string[] args) { Console.WriteLine($"Loading mods from {Environment.CurrentDirectory}"); var unitsMod = UnitLoader.LoadUnits(); Console.WriteLine($"Loaded {unitsMod.Count()} units: {unitsMod}"); var devil = unitsMod.First(); var angel = new Angel(); var lich = new Lich(); var shaman = new Shaman(); var fury = new Fury(); var cyclops = new Cyclops(); var menu = new Menu(new List <Unit>() { devil, angel, lich, shaman, fury, cyclops }); menu.Start(); }
public override void OnAttackComplete(Fury.Behaviors.Unit attacker, Fury.Behaviors.Unit target) { // Our attack damage is based on strength var tInt = 0; foreach (var stack in attacker.Controllers.TokenController.Stacks) if (stack.Token is Equipment && stack.States[0] > 0) tInt += (stack.Token as Equipment).Intelligence; // Create the effect var effect = (GameObject) GameObject.Instantiate(BurnEffect); // Position the effect var position = target.transform.position; effect.transform.position = position; effect.transform.parent = target.transform; // Reduce the target's health target.ModifyHealth(-(Damage + tInt / 3), attacker, this); }
public void WriteToXml(XmlWriter writer) { writer.WriteStartElement(Name); writer.WriteStartElement("stats"); writer.WriteElementString("str", _strength_base.ToString()); writer.WriteElementString("dex", _dexterity_base.ToString()); writer.WriteElementString("vit", _vitality_base.ToString()); writer.WriteElementString("mag", _magic_base.ToString()); writer.WriteElementString("spi", _spirit_base.ToString()); writer.WriteElementString("lck", _luck_base.ToString()); writer.WriteElementString("lvl", _level.ToString()); writer.WriteEndElement();//stats writer.WriteElementString("exp", _exp.ToString()); writer.WriteElementString("hp", _hp.ToString()); writer.WriteElementString("mp", _mp.ToString()); writer.WriteElementString("maxhp", _maxhp.ToString()); writer.WriteElementString("maxmp", _maxmp.ToString()); writer.WriteElementString("limitlvl", _limitlvl.ToString()); writer.WriteElementString("fury", Fury.ToString().ToLower()); writer.WriteElementString("sadness", Sadness.ToString().ToLower()); writer.WriteElementString("backRow", BackRow.ToString().ToLower()); writer.WriteStartElement("weapon"); writer.WriteElementString("name", Weapon.ID); writer.WriteStartElement("materia"); for (int i = 0; i < Weapon.Slots.Length; i++) { MateriaOrb m = Weapon.Slots[i]; if (m != null) { writer.WriteStartElement("orb"); writer.WriteAttributeString("name", m.Name); writer.WriteAttributeString("type", m.Type.ToString()); writer.WriteAttributeString("ap", m.AP.ToString()); writer.WriteAttributeString("slot", i.ToString()); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("armor"); writer.WriteElementString("name", Armor.ID); writer.WriteStartElement("materia"); for (int i = 0; i < Armor.Slots.Length; i++) { MateriaOrb m = Armor.Slots[i]; if (m != null) { writer.WriteStartElement("orb"); writer.WriteAttributeString("name", m.Name); writer.WriteAttributeString("type", m.Type.ToString()); writer.WriteAttributeString("ap", m.AP.ToString()); writer.WriteAttributeString("slot", i.ToString()); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteElementString("accessory", Accessory == null ? "" : Accessory.ID); writer.WriteEndElement(); }
public override object OnBeginCast(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { caster.Animator.CrossFade("cast-begin", 1000, CastTime, null, UnityEngine.WrapMode.ClampForever); return null; }
private void OnUnitDead(Fury.Behaviors.Unit deadUnit, Fury.Behaviors.Unit lastAttacker) { if (deadUnit.Properties is DummyLogic && Stage == TutorialStages.AttackDummies) Stage++; if (deadUnit.Properties is Tower && Stage == TutorialStages.DestroyTower) Stage++; }
private void OnFollowerSelected(Fury.Behaviors.Unit obj) { GameObject ring = (GameObject)GameObject.Instantiate(RingPrefab); ring.renderer.material = MaterialSelect; ring.name = "Selection Ring"; PlaceRing(ring, obj); }
public override object OnBeginCast(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, Vector3 position) { return null; }
private void OnUnitEnterTrigger(Fury.Behaviors.Unit unit, Collider other) { if (other == TowerWarning && Stage < TutorialStages.DestroyTower) Stage = TutorialStages.DestroyTower; }
private void OnFollowerDead(Fury.Behaviors.Unit target, Fury.Behaviors.Unit killer) { Selection.Remove(target); }
/// <summary> /// Check if the caster has enough energy. /// </summary> public override bool OnCheckUseOnTarget(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { // Check if caster has enough energy of the given type return caster.Controllers.VitalityController.HasEnergy(EnergyType, EnergyCost); }
private void OnFollowerDeselected(Fury.Behaviors.Unit obj) { var ring = obj.transform.FindChild("Selection Ring"); if (ring != null) GameObject.Destroy(ring.gameObject); }
public override bool OnCheckUseOnTarget(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { return target is Fury.Behaviors.Deposit; }
private void OnUnitSelected(Fury.Behaviors.Unit obj) { if (Stage == TutorialStages.SelectingUnits) Stage++; }
private void OnTokenStackCreated(Fury.Behaviors.Stack stack) { if (Stage == TutorialStages.LootItems && stack.Owner is Fury.Behaviors.Unit) Stage++; }
public override void OnTokenStackCreated(Fury.Behaviors.Stack stack) { }
private void OnTokenStackStateChanged(Fury.Behaviors.Stack stack, byte index, byte oldVal, byte newVal) { if (Stage == TutorialStages.LootItems && stack.Owner is Fury.Behaviors.Unit) Stage++; }
/// <summary> /// Start casting the ability. /// </summary> public override object OnBeginCast(Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { // TODO: Start casting animation, effect, etc return null; }
private void PlaceRing(GameObject ring, Fury.Behaviors.Targetable follower) { ring.renderer.enabled = true; ring.transform.parent = follower.transform; ring.renderer.material.color = follower.IsTeamOrNeutral(Owner) ? new Color(0f, 0.5f, 0f) : new Color(1f, 0f, 0f); ring.transform.localPosition = Vector3.up * 0.01f; ring.transform.localRotation = Quaternion.AngleAxis(Time.timeSinceLevelLoad * 30, Vector3.up); ring.transform.localScale = new Vector3(1f / follower.transform.localScale.x, 1f / follower.transform.localScale.y, 1f / follower.transform.localScale.z) * follower.Radius * .2f; }