Пример #1
0
        public void actualizar_Hechizo_Exito(short celda_id, short hechizo_id)
        {
            Spell      hechizo       = cuenta.game.character.get_Hechizo(hechizo_id);
            SpellStats datos_hechizo = hechizo.get_Stats();

            if (datos_hechizo.intervalo > 0 && !hechizos_intervalo.ContainsKey(hechizo.id))
            {
                hechizos_intervalo.Add(hechizo.id, datos_hechizo.intervalo);
            }

            if (!total_hechizos_lanzados.ContainsKey(hechizo.id))
            {
                total_hechizos_lanzados.Add(hechizo.id, 0);
            }

            total_hechizos_lanzados[hechizo.id]++;

            if (total_hechizos_lanzados_en_celda.ContainsKey(hechizo.id))
            {
                if (!total_hechizos_lanzados_en_celda[hechizo.id].ContainsKey(celda_id))
                {
                    total_hechizos_lanzados_en_celda[hechizo.id].Add(celda_id, 0);
                }

                total_hechizos_lanzados_en_celda[hechizo.id][celda_id]++;
            }
            else
            {
                total_hechizos_lanzados_en_celda.Add(hechizo.id, new Dictionary <int, int>()
                {
                    { celda_id, 1 }
                });
            }
        }
    // Use this for initialization
    public void SetUpCard()
    {
        QuantityText.text = Qty.ToString();

        if (GetComponentInChildren <Stats>())
        {
            Stats stats = GetComponentInChildren <Stats>();
            stats.SetStats(GetComponent <CardSummon>().SummonObject.GetComponent <CardObject>(), GetComponent <Card>().GetPowerAmount);
        }

        else if (GetComponentInChildren <SpellStats>())
        {
            Debug.Log("LookingforStats");
            SpellStats spellStats = GetComponentInChildren <SpellStats>();
            spellStats.SetStats(GetComponent <CardSpell>(), GetComponent <Card>().GetPowerAmount);
        }

        //Determines if in Level Scene or deck building scene
        if (FindObjectOfType <CardHand>() != null)
        {
            QuantityText.gameObject.SetActive(false);
            button.gameObject.SetActive(false);
        }
        else
        {
            QuantityText.gameObject.SetActive(true);
            button.gameObject.SetActive(true);
        }
    }
Пример #3
0
        public FallosLanzandoHechizo get_Puede_Lanzar_hechizo(short hechizo_id, Cell celda_actual, Cell celda_objetivo, Map mapa)
        {
            Spell hechizo = cuenta.game.character.get_Hechizo(hechizo_id);

            if (hechizo == null)
            {
                return(FallosLanzandoHechizo.DESONOCIDO);
            }

            SpellStats datos_hechizo = hechizo.get_Stats();

            if (datos_hechizo.lanzamientos_por_objetivo > 0 && total_hechizos_lanzados_en_celda.ContainsKey(hechizo_id) && total_hechizos_lanzados_en_celda[hechizo_id].ContainsKey(celda_objetivo.cellId) && total_hechizos_lanzados_en_celda[hechizo_id][celda_objetivo.cellId] >= datos_hechizo.lanzamientos_por_objetivo)
            {
                return(FallosLanzandoHechizo.DEMASIADOS_LANZAMIENTOS_POR_OBJETIVO);
            }

            if (datos_hechizo.es_celda_vacia && !es_Celda_Libre(celda_objetivo))
            {
                return(FallosLanzandoHechizo.NECESITA_CELDA_LIBRE);
            }

            if (datos_hechizo.es_lanzado_linea && !jugador_luchador.celda.AreCellsOnLine(celda_objetivo))
            {
                return(FallosLanzandoHechizo.NO_ESTA_EN_LINEA);
            }

            if (!get_Rango_hechizo(celda_actual, datos_hechizo, mapa).Contains(celda_objetivo.cellId))
            {
                return(FallosLanzandoHechizo.NO_ESTA_EN_RANGO);
            }

            return(FallosLanzandoHechizo.NINGUNO);
        }
Пример #4
0
        public List <short> get_Rango_hechizo(Cell celda_personaje, SpellStats datos_hechizo, Map mapa)
        {
            List <short> rango = new List <short>();

            foreach (Cell celda in SpellShape.Get_Lista_Celdas_Rango_Hechizo(celda_personaje, datos_hechizo, cuenta.game.map, cuenta.game.character.caracteristicas.alcanze.total_stats))
            {
                if (celda == null || rango.Contains(celda.cellId))
                {
                    continue;
                }

                if (datos_hechizo.es_celda_vacia && get_Celdas_Ocupadas.Contains(celda.cellId))
                {
                    continue;
                }

                if (celda.cellType != CellTypes.NOT_WALKABLE || celda.cellType != CellTypes.INTERACTIVE_OBJECT)
                {
                    rango.Add(celda.cellId);
                }
            }

            if (datos_hechizo.es_lanzado_con_vision)
            {
                for (int i = rango.Count - 1; i >= 0; i--)
                {
                    if (get_Linea_Obstruida(mapa, celda_personaje, mapa.GetCellFromId(rango[i]), get_Celdas_Ocupadas))
                    {
                        rango.RemoveAt(i);
                    }
                }
            }
            return(rango);
        }
Пример #5
0
        private async Task <ResultadoLanzandoHechizo> lanzar_Hechizo_Celda_Vacia(HechizoPelea hechizo_pelea)
        {
            if (pelea.get_Puede_Lanzar_hechizo(hechizo_pelea.id) != FallosLanzandoHechizo.NINGUNO)
            {
                return(ResultadoLanzandoHechizo.NO_LANZADO);
            }

            if (hechizo_pelea.focus == HechizoFocus.CELDA_VACIA && pelea.get_Cuerpo_A_Cuerpo_Enemigo().Count() == 4)
            {
                return(ResultadoLanzandoHechizo.NO_LANZADO);
            }

            Spell      hechizo       = cuenta.game.character.get_Hechizo(hechizo_pelea.id);
            SpellStats datos_hechizo = hechizo.get_Stats();

            List <short> rangos_disponibles = pelea.get_Rango_hechizo(pelea.jugador_luchador.celda, datos_hechizo, mapa);

            foreach (short rango in rangos_disponibles)
            {
                if (pelea.get_Puede_Lanzar_hechizo(hechizo_pelea.id, pelea.jugador_luchador.celda, mapa.GetCellFromId(rango), mapa) == FallosLanzandoHechizo.NINGUNO)
                {
                    if (hechizo_pelea.metodo_lanzamiento == MetodoLanzamiento.CAC || hechizo_pelea.metodo_lanzamiento == MetodoLanzamiento.AMBOS && mapa.GetCellFromId(rango).GetDistanceBetweenCells(pelea.jugador_luchador.celda) != 1)
                    {
                        continue;
                    }

                    await pelea.get_Lanzar_Hechizo(hechizo_pelea.id, rango);

                    return(ResultadoLanzandoHechizo.LANZADO);
                }
            }

            return(ResultadoLanzandoHechizo.NO_LANZADO);
        }
Пример #6
0
        public FallosLanzandoHechizo get_Puede_Lanzar_hechizo(short hechizo_id)
        {
            Spell hechizo = cuenta.game.character.get_Hechizo(hechizo_id);

            if (hechizo == null)
            {
                return(FallosLanzandoHechizo.DESONOCIDO);
            }

            SpellStats datos_hechizo = hechizo.get_Stats();

            if (jugador_luchador.pa < datos_hechizo.coste_pa)
            {
                return(FallosLanzandoHechizo.PUNTOS_ACCION);
            }

            if (datos_hechizo.lanzamientos_por_turno > 0 && total_hechizos_lanzados.ContainsKey(hechizo_id) && total_hechizos_lanzados[hechizo_id] >= datos_hechizo.lanzamientos_por_turno)
            {
                return(FallosLanzandoHechizo.DEMASIADOS_LANZAMIENTOS);
            }

            if (hechizos_intervalo.ContainsKey(hechizo_id))
            {
                return(FallosLanzandoHechizo.COOLDOWN);
            }

            if (datos_hechizo.efectos_normales.Count > 0 && datos_hechizo.efectos_normales[0].id == 181 && contador_invocaciones >= cuenta.game.character.caracteristicas.criaturas_invocables.total_stats)
            {
                return(FallosLanzandoHechizo.DEMASIADAS_INVOCACIONES);
            }

            return(FallosLanzandoHechizo.NINGUNO);
        }
Пример #7
0
    /*
     * Remember to move the turret's transform to 0.
     *
     */

    private void Awake()
    {
        spellStats                    = GetComponent <SpellStats>();
        collider                      = GetComponent <CircleCollider2D>();
        collider.radius               = spellStats.GetRange();
        collider.enabled              = false;
        currentShotNumber             = 0;
        turretAutofireCurrentCooldown = 0.5f;
    }
    //private bool enableHeal = false;

    private void Awake()
    {
        spellStats = GetComponent <SpellStats>();
        collider2D = GetComponent <CircleCollider2D>();

        totalHealingAmount = spellStats.GetSpellDamage();
        healingTurretRange = spellStats.GetRange();
        GetComponent <CircleCollider2D>().radius = healingTurretRange;
        amountPerHeal = totalHealingAmount / (effectTime / timeBetweenHeals);
    }
Пример #9
0
    public IEnumerator castCurrentSpell()
    {
        SpellStats spell = spellList[spellListIndex];

        if (stats.currentMana < spell.manaCost)
        {
            Debug.Log("Not enough mana to cast " + spell.name);
        }
        else if (spellListCooldowns[spellListIndex] > 0)
        {
            Debug.Log(spell.name + " is on cooldown");
        }
        else
        {
            Ray ray = cam.ScreenPointToRay(Input.mousePosition);

            //Initialise the enter variable
            float enter = 0.0f;

            new Plane(Vector3.up, spellCastOrigin.position.y).Raycast(ray, out enter);
            //Get the point that is clicked
            Vector3 mouseWorld = ray.GetPoint(enter);
            mouseWorld = new Vector3(mouseWorld.x, -1 * mouseWorld.y, mouseWorld.z);
            debugs.Add(mouseWorld);


            motor.CastTowardTarget(mouseWorld);
            yield return(new WaitForSeconds(spell.castTime));

            Debug.Log("Cast " + spell.name);
            GameObject spellGO = Instantiate(spell.prefab, spellCastOrigin.position, transform.rotation);

            stats.SpendMana(spell.manaCost);
            spellListCooldowns[spellListIndex] = spell.cooldown;
            playerController.UnlockActions();

            /*
             * Check if interrupted (stunned?)
             * } else {
             *  Debug.Log("About to cast spell " + spell.name + ", but was interrupted");
             * }
             */
        }
    }
Пример #10
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Task.Run(() =>
            {
                GlobalConfig.Load_All_Accounts();
                LuaScriptManager.inicializar_Funciones();
                XElement.Parse(Properties.Resources.interactivos).Descendants("SKILL").ToList().ForEach(i => new ObjetoInteractivoModelo(i.Element("nombre").Value, i.Element("gfx").Value, bool.Parse(i.Element("caminable").Value), i.Element("habilidades").Value, bool.Parse(i.Element("recolectable").Value)));
                PaqueteRecibido.Inicializar();
            }).ContinueWith(t =>
            {
                XElement.Parse(Properties.Resources.hechizos).Descendants("HECHIZO").ToList().ForEach(mapa =>
                {
                    Spell hechizo = new Spell(short.Parse(mapa.Attribute("ID").Value), mapa.Element("NOMBRE").Value);

                    mapa.Descendants("NIVEL").ToList().ForEach(stats =>
                    {
                        SpellStats hechizo_stats = new SpellStats();

                        hechizo_stats.coste_pa       = byte.Parse(stats.Attribute("COSTE_PA").Value);
                        hechizo_stats.alcanze_minimo = byte.Parse(stats.Attribute("RANGO_MINIMO").Value);
                        hechizo_stats.alcanze_maximo = byte.Parse(stats.Attribute("RANGO_MAXIMO").Value);

                        hechizo_stats.es_lanzado_linea       = bool.Parse(stats.Attribute("LANZ_EN_LINEA").Value);
                        hechizo_stats.es_lanzado_con_vision  = bool.Parse(stats.Attribute("NECESITA_VISION").Value);
                        hechizo_stats.es_celda_vacia         = bool.Parse(stats.Attribute("NECESITA_CELDA_LIBRE").Value);
                        hechizo_stats.es_alcanze_modificable = bool.Parse(stats.Attribute("RANGO_MODIFICABLE").Value);

                        hechizo_stats.lanzamientos_por_turno    = byte.Parse(stats.Attribute("MAX_LANZ_POR_TURNO").Value);
                        hechizo_stats.lanzamientos_por_objetivo = byte.Parse(stats.Attribute("MAX_LANZ_POR_OBJETIVO").Value);
                        hechizo_stats.intervalo = byte.Parse(stats.Attribute("COOLDOWN").Value);

                        stats.Descendants("EFECTO").ToList().ForEach(efecto => hechizo_stats.agregar_efecto(new SpellEffect(int.Parse(efecto.Attribute("TIPO").Value), Zones.Parse(efecto.Attribute("ZONA").Value)), bool.Parse(efecto.Attribute("ES_CRITICO").Value)));
                        hechizo.get_Agregar_Hechizo_Stats(byte.Parse(stats.Attribute("NIVEL").Value), hechizo_stats);
                    });
                });
            }).Wait();

            Application.Run(new Principal());
        }
Пример #11
0
        private Luchadores get_Objetivo_Mas_Cercano(HechizoPelea hechizo)
        {
            Spell Spell = cuenta.game.character.get_Hechizo(hechizo.id);



            SpellStats SpellStats = Spell.get_Stats();
            int        range      = SpellStats.alcanze_maximo;

            if (hechizo.focus == HechizoFocus.ENCIMA)
            {
                return(pelea.jugador_luchador);
            }

            if (hechizo.focus == HechizoFocus.CELDA_VACIA)
            {
                return(null);
            }

            return(hechizo.focus == HechizoFocus.ENEMIGO ? pelea.get_Obtener_Enemigo_Mas_Cercano(range) : pelea.get_Obtener_Aliado_Mas_Cercano());
        }
Пример #12
0
    void Update()
    {
        blockrotate = GetComponent <PlayerStats> ().currentShield.GetComponent <ShieldStats> ().turnspeed;
        blockmove   = GetComponent <PlayerStats> ().currentShield.GetComponent <ShieldStats> ().movespeed;

        float triggerval = Input.GetAxis(MyInput.Triggers_name);

        if (triggerval < -0.9 || Input.GetKey(KeyCode.Space))
        {
            myAnim.SetBool("attacking", true);
        }
        else
        {
            myAnim.SetBool("attacking", false);
        }

        if (triggerval > 0.9 || Input.GetKey(KeyCode.LeftShift))
        {
            myAnim.SetBool("blocking", true);
        }
        else
        {
            myAnim.SetBool("blocking", false);
        }

        // shoot spell
        if (transform.GetComponent <PlayerStats>().currentSpell != null && (Input.GetButtonDown(MyInput.RB_name) || Input.GetKeyDown(KeyCode.E)) &&
            spellTimeStamp < Time.time)
        {
            GameObject obj = (GameObject)Instantiate(Resources.Load("Prefabs/Items/SpellProjectile"));
            obj.transform.position = transform.position + new Vector3(0f, 1f, 0f) + transform.forward;
            ParticleSystem            ps     = obj.GetComponent <ParticleSystem>();
            ParticleSystem.MainModule psmain = ps.main;
            psmain.startColor = transform.GetComponent <PlayerStats>().currentSpell.GetComponent <ParticleSystem>().GetComponent <Renderer>().material.color;
            obj.GetComponent <Rigidbody>().velocity = 3f * transform.forward;

            SpellStats spell = transform.GetComponent <PlayerStats>().currentSpell.GetComponent <SpellStats>();
            spellTimeStamp = Time.time + spell.cooldown;
        }
    }
    // Use this for initialization
    void Start()
    {
        CharacterState.CharacterStateSubscription hammerStateSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_THROW_CAST_STATE);
        hammerStateSubscription.OnStateChanged += CheckHammerState;
        CharacterState.CharacterStateSubscription hammerHitPlayerSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_PLAYER);
        hammerHitPlayerSubscription.OnStateChanged += CheckHammerHitPlayerState;
        CharacterState.CharacterStateSubscription hammerHitGroundSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HITS_GROUND);
        hammerHitGroundSubscription.OnStateChanged += CheckHammerHitGround;
        CharacterState.CharacterStateSubscription enemyHitHammerSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_ENEMY);
        enemyHitHammerSubscription.OnStateChanged += CheckEnemyHitHammerState;

        hammerThrown = statesManager.GetExistingCharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_THROWN);
        bcb          = GetComponentInParent <BossCastingBehavior>();
        spellStats   = GetComponent <SpellStats>();
        hammerMoving = false;
        hammerPickUp = true;
        psm          = GetComponent <ProjectileStraightMovement>();
        //Get hammer throw prefab
        hammerThrow    = bcb.GetAttack(2);
        rgb            = GetComponent <Rigidbody2D>();
        hammerPosition = new Vector2(0, 1.5f);        //Change this value to set how high boss holds hammer while walking
    }
Пример #14
0
 private void Awake()
 {
     spellStats = GetComponent <SpellStats>();
 }
 private void Awake()
 {
     spellSpawnLocation = transform.position;
     spellStats         = GetComponent <SpellStats>();
     despawnRange       = spellStats.GetRange();
 }
Пример #16
0
 void Start()
 {
     spellStats = new SpellStats();
     PopulateLists();
 }
 // Use this for initialization
 void Start()
 {
     spellStats      = GetComponent <SpellStats> ();
     projectileSpeed = spellStats.GetProjectileSpeed();
 }
 public Spell(SpellAttibute Arcane, SpellAttibute Fire, SpellAttibute Frost, SpellAttibute Holy, SpellAttibute Nature, SpellAttibute Shadow, int Healing, SpellStats Stats)
 {
     this.arcane = Arcane;
     this.fire = Fire;
     this.frost = Frost;
     this.holy = Holy;
     this.nature = Nature;
     this.shadow = Shadow;
     this.healing = Healing;
     this.stats = Stats;
 }