Inheritance: AbilityBehaviours
Esempio n. 1
0
        public void InflictStatus(WorldObject target, WorldObject inflicter, AreaOfEffect aoeInflicter)
        {
            this.inflictor    = inflicter;
            this.aoeInflicter = aoeInflicter;

            InflictStatus(target);
        }
Esempio n. 2
0
        public static ISpell CreateTeleportSpell(World world)
        {
            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            return(new Spell("Teleport", 2, areaOfEffect, true, world, new TeleportStrategy(), false));
        }
Esempio n. 3
0
            /// <summary>
            /// Starts an encounter.
            /// </summary>
            /// <param name="encounterType">The type of encounter that was engaged.</param>
            /// <param name="fieldSize">The size of the encounter zone.</param>
            /// <param name="units">The units initially engaged in the encounter.</param>
            public void BeginEncounter(EncounterTypes encounterType, AreaOfEffect fieldSize, List <Unit> units)
            {
                encounterActive = true;
                currentRound    = 0;
                this.fieldSize  = fieldSize;
                turnOrder       = CreateTurnOrder(units);
                OrganizeTurnOrder();

                UtilityFunctions.GetActiveUnitDetector().AddIndicatorTiles(fieldSize.GetAllTiles(), TileIndicatorTypes.Encounter);


                foreach (Unit unit in units)
                {
                    Debug.Log(unit.GetType());
                }

                switch (encounterType)
                {
                case EncounterTypes.Advantage:
                    GrantPriorityToAllOfType(TargetTypes.Ally);
                    break;

                case EncounterTypes.Disadvantage:
                    GrantPriorityToAllOfType(TargetTypes.Enemy);
                    break;
                }

                //playerController.inputsDisabled = false;
                //uiController.PushUI(UIScreens.EncounterScreen, true);
                controllerReference.StartCoroutine(EncounterLoop());
            }
Esempio n. 4
0
        private Vector3 RandomLocationInAoe(AreaOfEffect area, Target origin)
        {
            Assert.IsNotNull(area);
            switch (area.Area)
            {
            case AreaOfEffect.AreaType.Cone:
                return(AoeUtility.RandomInCone(
                           origin.Position,
                           origin.Forward,
                           area.Angle.GetValue(SpellHandler.Stacks),
                           area.Size.GetValue(SpellHandler.Stacks),
                           area.MinSize.GetValue(SpellHandler.Stacks)));

            case AreaOfEffect.AreaType.Sphere:
                return(AoeUtility.RandomInsideSphere(origin.Position,
                                                     area.Size.GetValue(SpellHandler.Stacks),
                                                     area.MinSize.GetValue(SpellHandler.Stacks)));

            case AreaOfEffect.AreaType.Line:
                return(AoeUtility.RandomInLine(origin.Position, Target.Position));

            default:
                throw new InvalidOperationException($"Invalid area type: {area.Area}");
            }
        }
    protected override void OnInstantiate(AreaOfEffect aoe)
    {
        //GameObject impact = Instantiate(impactPrefab) as GameObject;
        //impact.transform.position = aoe.transform.position.z(Map.use.GetDepthByPercentage(1f));

        //SoundManager.use.PlaySound(LugusAudio.use.SFX(), SoundManager.use.GetRandomExplosionSound());
    }
Esempio n. 6
0
 private void SelectCell(Cell cell, Cell origin, bool mustBeEmpty, bool lineOfSight, bool addCellToAoe)
 {
     if (cell.IsWalkable == true)
     {
         if ((mustBeEmpty && cell.IsTaken != null) || Selection.Contains(MapInfos.ProjectionMap[cell.X, cell.Z]))
         {
             return;
         }
         if (lineOfSight)
         {
             RaycastHit hit;
             Vector3    startPos = origin.GetVector3PositionSimple() + new Vector3(0, 0.5f, 0);
             Vector3    endPos   = cell.GetVector3PositionSimple() + new Vector3(0, 0.5f, 0);
             float      dist     = Vector3.Distance(endPos, startPos);
             Physics.Raycast(startPos, endPos - startPos, out hit, dist);
             if (hit.collider != null)
             {
                 if (hit.collider.name != "Collider" || (hit.collider.name == "Collider" && hit.distance + 0.6f < dist))
                 {
                     NotInLOS.Add(MapInfos.ProjectionMap[cell.X, cell.Z]);
                     return;
                 }
             }
         }
         if (addCellToAoe)
         {
             AreaOfEffect.Add(cell);
         }
         Selection.Add(MapInfos.ProjectionMap[cell.X, cell.Z]);
     }
 }
Esempio n. 7
0
        public static ISpell CreateFireballSpell(World world)
        {
            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            return(new Spell("Fireball", 5, areaOfEffect, true, world, new FireballStrategy(10, 25), false));
        }
Esempio n. 8
0
 public static void InflictStatus(WorldObject inflicter, AreaOfEffect aoeInflicter, Status status, WorldObject target)
 {
     if (target)
     {
         InflictStatus(inflicter, aoeInflicter, status, target, target.transform.position, new Quaternion());
     }
 }
Esempio n. 9
0
 void Start()
 {
     pAnim           = GetComponent <Animator>();
     playMov         = GetComponent <PlayerMovement>();
     penetratorNator = GetComponent <AreaOfEffect>();
     gun             = GetComponent <PewPew>();
 }
Esempio n. 10
0
    public void SwitchAttackMode()
    {
        if (attackMode)
        {
            attackMode            = false;
            avalibleMovementTiles = AreaCalculations.GetTilesAvalibleForMovement(currentCharacter);

            if (attackArea != null)
            {
                ClearTiles(attackArea.AffectedTiles);
                ClearTilesFromHashtable(attackArea.AffectedCharacters);
            }

            ShowTilesFromHashtable(avalibleMovementTiles, tileAvailableForMove);
        }
        else
        {
            attackMode = true;
            ClearTilesFromHashtable(avalibleMovementTiles);

            if (currentCharacter.ActionAvailable)
            {
                attackArea = AreaCalculations.GetAreaOfEffect(Vector3Int.FloorToInt(currentCharacter.transform.position), currentCharacter.AttackRange, currentCharacter.Team);
                ShowTiles(attackArea.AffectedTiles, tileAffected);
                ShowTilesFromHashtable(attackArea.AffectedCharacters, tileTarget);
            }
        }
    }
Esempio n. 11
0
            /// <summary>
            /// Logic for the beginning of an encounter turn.
            /// </summary>
            /// <param name="unitTurn">The <see cref="UnitTurn"/> of the current unit's turn.</param>
            void StartTurn(UnitTurn unitTurn)
            {
                UtilityFunctions.GetActiveUnitDetector()
                .FlagDelegate(DelegateFlags.OnEncounterTurnStart, new TurnStartHookBundle(unitTurn), GetEncounterUnitList());

                unitTurn.isActive     = true;
                currentTurn           = unitTurn;
                currentUnitMoveBounds = new AreaOfEffect(unitTurn.unit.position, 5);
                UtilityFunctions.GetActiveUnitDetector().AddIndicatorTiles(currentUnitMoveBounds.GetAllTiles(), TileIndicatorTypes.Movement);

                Debug.Log(UtilityFunctions.GetUnitName(unitTurn) + ":turn started; waiting");

                if (CanUnitTakeAction(currentTurn))
                {
                    if (unitTurn.unit.GetTargetType() == TargetTypes.Enemy)
                    {
                        //CheckEncounterAI(unitTurn);
                    }
                    else
                    {
                        //playerController.SetPlayerUnit(currentTurn.unit);
                        //uiController.PushUI(UIScreens.EncounterScreen, true);
                    }
                }
                else
                {
                    Debug.Log("due to impairment, unit cannot take action");
                    EndTurn(currentTurn);
                }
            }
Esempio n. 12
0
        public static ISpell CreateHealSelfSpell(World world)
        {
            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            return(new Spell("Heal Self", 2, areaOfEffect, false, world, new HealSelfStrategy(5, 20), false));
        }
Esempio n. 13
0
 /// <summary>
 /// Creates a new <see cref="UnitSpawner"/>.
 /// </summary>
 /// <param name="maxUnits">The maximum unit count for the UnitSpawner.</param>
 /// <param name="spawnRange">The range of the UnitSpawner.</param>
 /// <param name="unitLevel">The level of the units created by the UnitSpawner.</param>
 /// <param name="spawnTime">The spawn time of units created by the UnitSpawner.</param>
 public UnitSpawner(string unitJSONFileName, int maxUnits, AreaOfEffect spawnRange, int unitLevel, float spawnTime = 60f)
 {
     this.unitJSONFileName = unitJSONFileName;
     this.maxUnits         = maxUnits;
     this.spawnRange       = spawnRange;
     this.spawnTime        = spawnTime;
     this.unitLevel        = unitLevel;
 }
Esempio n. 14
0
 public AIAction(double aggro, double def, int numT, int AoE, string path)
 {
     aggression = aggro;
     defense = def;
     NumberOfTargets = numT;
     Target = (AreaOfEffect)AoE;
     actionEffect = path;
     UseCost = new Dictionary<StatType, double>();
 }
Esempio n. 15
0
    protected override void OnProjectileReachedEnd(Projectile projectile)
    {
        AreaOfEffect aoe = Instantiate(explosionAreaOfEffectPrefab, projectile.transform.position, projectile.transform.rotation).GetComponent <AreaOfEffect>();

        aoe.CreateAreaOfEffect(projectile.UnitsAlreadyHit, champion.Team, affectedUnitType, durationAoE, true);
        aoe.ActivateAreaOfEffect();
        aoe.OnAbilityEffectHit += OnAreaOfEffectHit;
        Destroy(projectile.gameObject);
    }
Esempio n. 16
0
    protected void Explode()
    {
        m_removing = true;

        AreaOfEffect aoe = Instantiate(m_aoe, this.transform.position, this.transform.rotation) as AreaOfEffect;

        aoe.m_value = this.m_value;
        Destroy(this.gameObject);
    }
Esempio n. 17
0
    protected void Explode()
    {
        AreaOfEffect aoe = Instantiate(m_aoe, this.transform.position, this.transform.rotation) as AreaOfEffect;

        aoe.m_value = this.m_value;
        Destroy(this.gameObject);

        SoundManager.use.PlaySound(LugusAudio.use.SFX(), SoundManager.use.GetRandomExplosionSound());
    }
Esempio n. 18
0
 public static ISpell CreateInfernoSpell(World world)
 {
     AreaOfEffect areaOfEffect = new AreaOfEffect(world);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, -1), 1);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 1), 1);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(1, -1), 1);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(1, 1), 1);
     return new Spell("Inferno", 5, areaOfEffect, true, world, new InfernoStrategy(10, 25), false);
 }
Esempio n. 19
0
 public AbstractTurret(int maxHealth, int attackDamage, float cooldown, int row, int column, float fireRate, int shotAmount, AreaOfEffect areaOfEffect, TurretState turretState)
     : base(maxHealth, attackDamage, cooldown, row, column)
 {
     FireRate = fireRate;
     maximumAmmo = shotAmount;
     CurrentAmmo = shotAmount;
     Cost = cost;
     this.areaOfEffect = areaOfEffect;
     this.turretState = turretState;
 }
Esempio n. 20
0
 public Spell(string name, int manaCost, AreaOfEffect affectedArea, bool targetCanMove, World world, ICastStrategy castStrategy, bool allowRotation)
 {
     Name          = name;
     ManaCost      = manaCost;
     _world        = world;
     _castStrategy = castStrategy;
     TargetCanMove = targetCanMove;
     AffectedArea  = affectedArea;
     AllowRotation = allowRotation;
 }
Esempio n. 21
0
 public Spell(string name, int manaCost, AreaOfEffect affectedArea, bool targetCanMove, World world, ICastStrategy castStrategy, bool allowRotation)
 {
     Name = name;
     ManaCost = manaCost;
     _world = world;
     _castStrategy = castStrategy;
     TargetCanMove = targetCanMove;
     AffectedArea = affectedArea;
     AllowRotation = allowRotation;
 }
Esempio n. 22
0
        public static ISpell CreateInfernoSpell(World world)
        {
            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, -1), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 1), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(1, -1), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(1, 1), 1);
            return(new Spell("Inferno", 5, areaOfEffect, true, world, new InfernoStrategy(10, 25), false));
        }
Esempio n. 23
0
        /// <summary>
        /// Called when the simulation wants this force effect to apply forces to rigid bodies.
        /// </summary>
        /// <remarks>
        /// <para>
        /// <strong>Notes to Inheritors:</strong>
        /// This method must be implemented in derived classes. This method is only called after the
        /// force effect was added to a simulation and <see cref="ForceEffect.OnAddToSimulation"/> was
        /// called.
        /// </para>
        /// <para>
        /// This method uses the <see cref="IAreaOfEffect"/> to call <see cref="Apply"/> for each rigid
        /// body in the area of effect.
        /// </para>
        /// </remarks>
        protected override void OnApply()
        {
            if (EndTime <= Simulation.Time)
            {
                // The effect has ended. Remove from the force effects.
                Simulation.ForceEffects.Remove(this);
                return;
            }

            AreaOfEffect.Apply(this);
        }
Esempio n. 24
0
	// Use this for initialization
	void Start () {
		_laser = GetComponentInChildren<LaserBeam>();
		_chargeAudio = GetComponent<AudioSource>();
		_initialEyeRotation = transform.localRotation;
		_areaOfEffect = GetComponentInChildren<AreaOfEffect>();
		_areaOfEffect.Triggered += ActivatePlayerTracking;
		_target = _hero.LookAtTransform;
		_followTarget = true;

		IrisCharge = DeactivatedChargeValue;
		EnableLaser(false);
	}
Esempio n. 25
0
 public static ISpell CreateFlameSpell(World world)
 {
     AreaOfEffect areaOfEffect = new AreaOfEffect(world);
     //areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 0.75);
     //areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 0.50);
     //areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, 0), 0.25);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 1);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 0.75);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, 0), 0.5);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, -1), 0.25);
     return new Spell("Flame", 5, areaOfEffect, false, world, new FireballStrategy(10, 25), false);
 }
Esempio n. 26
0
        public override void ActionResult(byte actionToken, List <int> objectList, Vector3 bombedPos)
        {
            if (ActionTokens.ContainsKey(actionToken) == false)
            {
                //Log.Information($"ActionResult already execute ({string.Join(",", objectList)}), {actionToken}");
                return;
            }

            //if(objectList.Count > 0)
            //    Log.Information($"ActionResult ({string.Join(",", objectList)}), {actionToken}");

            JSkillData skillData = ACDC.SkillData[ActionTokens[actionToken].SkillId];

            NetGameObject obj;

            for (int i = 0; i < objectList.Count; ++i)
            {
                obj = NetworkManagerServer.sInstance.GetGameObject(objectList[i], WorldId);
                if (obj == null)
                {
                    continue;
                }

                var applyDamage = obj.OnExplode((int)GetPlayerId(), GetNetworkId(), GetDamage(ActionTokens[actionToken].SkillId, (GameObjectClassId)obj.GetClassId()));

                // add spell
                SActor actor = obj as SActor;
                if (actor != null && skillData != null)
                {
                    //actor.AddableSpell((int)GetPlayerId(), skillData.spellId);

                    //Log.Information($"ActionResult AddSpell {skillData.spellId}");
                    foreach (int nSpellID in skillData.spellId)
                    {
                        actor.AddableSpell(this, (int)GetPlayerId(), nSpellID, applyDamage);
                    }
                }
            }

            // Link Skill
            if (skillData != null && skillData.linkSkillId != 0)
            {
                var linkSkillData = ACDC.SkillData[skillData.linkSkillId];

                if (linkSkillData != null && linkSkillData.skillType == (int)SkillType.InstallAreaOfEffect)
                {
                    AreaOfEffect aoe = (AreaOfEffect)GameObjectRegistry.sInstance.CreateGameObject((uint)GameObjectClassId.AreaOfEffect, true, WorldId);
                    aoe.InitFrom(this, (ushort)linkSkillData.skillId, bombedPos);
                }
            }

            ActionTokens.Remove(actionToken);
        }
Esempio n. 27
0
        public static ISpell CreateFlameSpell(World world)
        {
            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            //areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 0.75);
            //areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 0.50);
            //areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, 0), 0.25);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 0.75);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, 0), 0.5);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-3, -1), 0.25);
            return(new Spell("Flame", 5, areaOfEffect, false, world, new FireballStrategy(10, 25), false));
        }
Esempio n. 28
0
    protected IEnumerator AreaAppear(Vector2 position, Side side)
    {
        OnBegin(position, side);
        m_timer = m_cooldown;

        yield return(new WaitForSeconds(instantiateDelay));

        AreaOfEffect aoe = Instantiate(m_prefabEffect, position, Quaternion.identity) as AreaOfEffect;

        aoe.Initialize(side);

        OnInstantiate(aoe);
    }
 public void Listen(TargetedAbility listener, AreaOfEffect aoe = 0, Tile orig = null)
 {
     _aoe  = aoe;
     _orig = orig;
     Tile.UnColourAll();
     this.listener = listener;
     StateManager.Instance.DebugPush(GameState.targetingAbility);
     _targets = listener.GetAvailableTargets();
     foreach (Tile t in _targets)
     {
         t.ColourMe(Color.green);
     }
 }
Esempio n. 30
0
        public GameObject SpawnInstance(Vector3 position, Quaternion rotation, AreaOfEffect aoe, int stacks)
        {
            var go = Instantiate(Prefab, position, rotation, transform);

            if (DestroyAfterLifetime)
            {
                Destroy(go, Lifetime);
            }
            if (ScaleWithAoE && aoe != null)
            {
                go.transform.localScale *= aoe.Size.GetValue(stacks);
            }
            return(go);
        }
Esempio n. 31
0
        public static ISpell CreateFirewallSpell(World world)
        {
            // fire should burn anything on it right away, and any creatures that walk into should be burnt as they enter.

            AreaOfEffect areaOfEffect = new AreaOfEffect(world);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(1, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(2, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(3, 0), 1);

            return new Spell("Firewall", 5, areaOfEffect, true, world, new FireballStrategy(10, 25), true);
        }
Esempio n. 32
0
    private void PerformAttack(RaycastHit2D hit)
    {
        if (attackArea == null)
        {
            return;
        }

        Vector3    mouseWorldPos   = camera.ScreenToWorldPoint(Input.mousePosition);
        Vector3Int tilemapMousePos = UILayer.WorldToCell(mouseWorldPos);

        if (attackArea.AffectedCharacters.Contains(tilemapMousePos))
        {
            Character targetCharacter = (Character)attackArea.AffectedCharacters[tilemapMousePos];
            Attack    attack          = currentCharacter.PerformMainHandAttack(targetCharacter.ArmorClass);

            RollResultWithCriticals rollResult = attack.HitRoll();

            logEvent.Invoke(currentCharacter.name + " attacks " + targetCharacter.name);
            logEvent.Invoke($"Attack roll: {rollResult.Representation}");

            if (rollResult.CriticalSuccess || rollResult.Value >= targetCharacter.ArmorClass)
            {
                DamageRollResult damageResult = attack.DamageRoll();
                logEvent.Invoke($"Damage: {damageResult.Representation}");
                targetCharacter.TakeDamage(damageResult.Value);
                logEvent.Invoke($"{targetCharacter.name} takes {damageResult.Value} damage");
            }
            //else if ()
            //{
            //    //logEvent.Invoke("Hit value: " + rollResult.Value);
            //    int damage = attack.DamageRoll();
            //    targetCharacter.TakeDamage(damage);
            //    logEvent.Invoke(targetCharacter.name + " takes " + damage + " damage");
            //}
            else
            {
                logEvent.Invoke(currentCharacter.name + " misses");
            }
            //{
            //    //logEvent.Invoke("Hit value: " + rollResult.Value);

            //}

            ClearTiles(attackArea.AffectedTiles);
            ClearTilesFromHashtable(attackArea.AffectedCharacters);

            attackArea = null;
        }
    }
Esempio n. 33
0
        public static ISpell CreateFirewallSpell(World world)
        {
            // fire should burn anything on it right away, and any creatures that walk into should be burnt as they enter.

            AreaOfEffect areaOfEffect = new AreaOfEffect(world);

            areaOfEffect.affectedBaseIndices.Add(new Vector2(-1, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(-2, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(1, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(2, 0), 1);
            areaOfEffect.affectedBaseIndices.Add(new Vector2(3, 0), 1);

            return(new Spell("Firewall", 5, areaOfEffect, true, world, new FireballStrategy(10, 25), true));
        }
Esempio n. 34
0
        public static void InflictStatus(WorldObject inflicter, AreaOfEffect aoeInflicter, Status status, WorldObject target, Vector3 spawnPoint, Quaternion rotation)
        {
            // if it is not possible to add the status on the target, skip the rest
            if (!target || !target.CanAddStatus())
            {
                return;
            }

            Status newStatusInstance = InstantiateStatus(status, spawnPoint, rotation);

            if (newStatusInstance)
            {
                newStatusInstance.InflictStatus(target, inflicter, aoeInflicter);
            }
        }
Esempio n. 35
0
 public void Action(Vector2 position, Faction faction)
 {
     if (areaOfEffectPrefab != null) //Apply Area Of Effect at mouse position
     {
         AreaOfEffect newAreaOfEffect = Instantiate(areaOfEffectPrefab, position, Quaternion.identity);
         newAreaOfEffect.faction = faction;
         Mirror.NetworkServer.Spawn(newAreaOfEffect.gameObject);
     }
     if (summon != null) //summon unit at mouse position
     {
         Unit newUnit = Instantiate(summon, position, Quaternion.identity);
         newUnit.faction = faction;
         Mirror.NetworkServer.Spawn(newUnit.gameObject);
     }
 }
Esempio n. 36
0
        private void FillTargetsInAoe(List <Target> targets, AreaOfEffect area, Target origin)
        {
            targets.Clear();
            Assert.IsNotNull(area, "Area must be set to use FillTargetsInAoe");
            IEnumerable <Vector3> positions;

            switch (area.Area)
            {
            case AreaOfEffect.AreaType.Cone:
                positions = AoeUtility.EnumerateLocationsInCone(
                    origin.OffsettedPosition,
                    origin.Forward,
                    area.Angle.GetValue(Stacks),
                    area.Size.GetValue(Stacks),
                    area.MinSize.GetValue(Stacks),
                    1f);
                break;

            case AreaOfEffect.AreaType.Sphere:
                positions = AoeUtility.EnumerateLocationsInCircle(
                    origin.OffsettedPosition,
                    area.Size.GetValue(Stacks),
                    area.MinSize.GetValue(Stacks),
                    1f);
                break;

            case AreaOfEffect.AreaType.Line:
                // Todo: eliminate direct usage of Target
                positions = AoeUtility.EnumerateLocationsInLine(
                    origin.OffsettedPosition,
                    Target.OffsettedPosition);
                break;

            default:
                positions = null;
                break;
            }

            if (positions == null)
            {
                return;
            }

            foreach (var pos in positions)
            {
                targets.Add(new Target(pos));
            }
        }
Esempio n. 37
0
            /// <summary>
            /// Logic for ending an encounter and resuming overworld gameplay state.
            /// </summary>
            void CloseEncounter()
            {
                controllerReference.StopAllCoroutines();
                encounterActive = false;
                currentRound    = 0;
                fieldSize       = null;
                UtilityFunctions.GetActiveUnitDetector().RemoveUnitSetup();

                //playerController.inputsDisabled = false;
                //uiController.PushUI(UIScreens.GameScreen, true);
                UnitDetector unitDetector = UtilityFunctions.GetActiveUnitDetector();

                unitDetector.SetAutomaticAIActivity(true);
                //UnitDetectorController.MapAggroRadiusToUnit(playerController.GetPlayerUnit());
                //unitDetectorController.StartCoroutine(unitDetectorController.ReduceAggroRadius());
            }
Esempio n. 38
0
 public bool CastSpell(ICreature caster, Vector2 targetWorldIndex, AreaOfEffect affectedArea, World world)
 {
     int healthRestored = RandomNumberProvider.GetRandomNumber(_minimumHealthToRestore, _maximumHealthToRestore);
     if (caster.Health.Current + healthRestored >= caster.Health.Maximum)
     {
         caster.Health.Current = caster.Health.Maximum;
         Announcer.Instance.Announce(caster.Name + " returned to full health!", MessageTypes.Spell);
     }
     else
     {
         caster.Health.Current += healthRestored;
         Announcer.Instance.Announce(caster.Name + " recovered " + healthRestored + " health.", MessageTypes.Spell);
     }
     world.AddSpecialEffectToWorld(new Heal(caster.WorldIndex, caster.WorldIndex, world));
     return true;
 }
Esempio n. 39
0
        public bool CastSpell(ICreature caster, Vector2 targetWorldIndex, AreaOfEffect affectedArea, World world)
        {
            ITerrain targetTile = world.Tiles[(int)targetWorldIndex.X, (int)targetWorldIndex.Y];

            if (targetTile.IsExploredByPlayer && targetTile.CanCreatureEnter(caster) && world.IsWorldIndexFreeOfObstacles(targetWorldIndex))
            {
                caster.WorldIndex = targetWorldIndex;
                world.CenterCameraOnPlayer();
                world.DiscoverTerrainAroundPlayer();
            }
            else
            {
                Announcer.Instance.Announce(caster.Name + " tried to teleport, but could not.", MessageTypes.SpellFailure);
            }

            return true;
        }
Esempio n. 40
0
        public Inferno(Vector2 targetIndex, World world, AreaOfEffect affectedArea)
        {
            _magicCircleImage = ContentHelper.Content.Load<Texture2D>(@"Magic\MagicCircle3x3");
            _firstUpdate = new TimeSpan();
            _lifespan = new TimeSpan(0, 0, 3);
            _world = world;
            _targetIndex = targetIndex;

            affectedWorldIndices = affectedArea.GetAffectedWorldIndices(targetIndex);

            tileFire = new DodongosQuest.ParticleSystem.TileFireParticleSystem(GameReference.Game, 5);
            GameReference.Game.Components.Add(tileFire);
            tileFire._world = world;
            tileFire.particleSystemFinished += new DodongosQuest.ParticleSystem.ParticleSystem.ParticleSystemFinishedEventHandler(tileFire_particleSystemFinished);
            foreach (KeyValuePair<Vector2, double> affectedWorldIndex in affectedWorldIndices)
            {
                tileFire.AddParticles(affectedWorldIndex.Key, new Vector2(0,0));
            }
        }
Esempio n. 41
0
        public bool CastSpell(ICreature caster, Vector2 targetWorldIndex, AreaOfEffect affectedArea, World world)
        {
            affectedWorldIndicies = affectedArea.GetAffectedWorldIndices(targetWorldIndex);
            damage = RandomNumberProvider.GetRandomNumber(_minimumDamage, _maximumDamage);

            foreach (KeyValuePair<Vector2, double> affectedWorldIndex in affectedWorldIndicies)
            {
                ICreature target = world.GetCreatureAtIndex(affectedWorldIndex.Key);
                if (target != null)
                {
                    int actualDamage = (int)(damage * affectedWorldIndex.Value);
                    Announcer.Instance.Announce(target.Name + " was hit by a fireball for " + actualDamage + " damage!", MessageTypes.Spell);
                    target.Health.Current -= actualDamage;
                }
            }
            world.AddSpecialEffectToWorld(new Inferno(targetWorldIndex, world, affectedArea));

            return true;
        }
Esempio n. 42
0
        private List<ulong> GetTarget(ulong user, int numTargets, AreaOfEffect AoE)
        {
            List<ulong> targets = new List<ulong>();
            switch (AoE)
            {
                case AreaOfEffect.ALLY_ALL:
                    targets.AddRange(aiSystem.GetAllies(user));
                    break;
                case AreaOfEffect.ALLY_CHOSEN:
                    break;
                case AreaOfEffect.ALLY_RANDOM:
                    {
                        int count = aiSystem.GetAllies(user).Count;
                        if (count == 0)
                        {
                            targets.Add(user);
                            break;
                        }
                        if (count <= numTargets)
                            targets.AddRange(aiSystem.GetAllies(user));
                        else
                            targets.AddRange(RandomTarget(numTargets, aiSystem.GetAllies(user)));

                        if (targets.Count < numTargets)
                            targets.Add(user);
                        break;
                    }
                case AreaOfEffect.ANY_ALL:
                    targets.AddRange(aiSystem.GetEnemies(user));
                    targets.AddRange(aiSystem.GetAllies(user));
                    targets.Add(user);
                    break;
                case AreaOfEffect.ANY_RANDOM:
                    {
                        List<ulong> possibleTargets = new List<ulong>();
                        possibleTargets.AddRange(aiSystem.GetEnemies(user));
                        possibleTargets.AddRange(aiSystem.GetAllies(user));
                        possibleTargets.Add(user);

                        targets.AddRange(RandomTarget(numTargets, possibleTargets));
                        break;
                    }
                case AreaOfEffect.ENEMY_ALL:
                    targets.AddRange(aiSystem.GetEnemies(user));
                    break;
                case AreaOfEffect.ENEMY_CHOSEN:
                    //if (user != playerSystem.CurrentPlayer)
                        targets = GetTarget(user, numTargets, AreaOfEffect.ENEMY_RANDOM);
                    break;
                case AreaOfEffect.ENEMY_RANDOM:
                    {
                        int count = aiSystem.GetEnemies(user).Count;
                        if (count <= numTargets)
                        {
                            targets.AddRange(aiSystem.GetEnemies(user));
                            break;
                        }

                        targets.AddRange(RandomTarget(numTargets, aiSystem.GetEnemies(user)));
                        break;
                    }
                case AreaOfEffect.USER:
                    targets.Add(user);
                    break;

                default: return null;
            }
            return targets;
        }
Esempio n. 43
0
 public void Explode(GameObject target, int attackMask, float damagePerHit, float attackRadius)
 {
     AreaOfEffect aoe = new AreaOfEffect();
     aoe.AreaExplode(target.transform.position, attackRadius, damagePerHit, gameObject, attackMask);
 }
Esempio n. 44
0
 public void Slam(GameObject target, int attackMask, float damagePerHit, float stunDuration, float attackRadius)
 {
     AreaOfEffect aoe = new AreaOfEffect();
     m_Animation.CrossFade("Attack");
     aoe.AreaStun(target.transform.position, attackRadius, damagePerHit, stunDuration, gameObject, attackMask);
 }
Esempio n. 45
0
 public static ISpell CreateFireboltSpell(World world)
 {
     AreaOfEffect areaOfEffect = new AreaOfEffect(world);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
     return new Spell("Firebolt", 5, areaOfEffect, true, world, new FireballStrategy(2, 8), false);
 }
Esempio n. 46
0
 public static ISpell CreateHealSelfSpell(World world)
 {
     AreaOfEffect areaOfEffect = new AreaOfEffect(world);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
     return new Spell("Heal Self", 2, areaOfEffect, false, world, new HealSelfStrategy(5, 20), false);
 }
Esempio n. 47
0
 public static ISpell CreateTeleportSpell(World world)
 {
     AreaOfEffect areaOfEffect = new AreaOfEffect(world);
     areaOfEffect.affectedBaseIndices.Add(new Vector2(0, 0), 1);
     return new Spell("Teleport", 2, areaOfEffect, true, world, new TeleportStrategy(), false);
 }