コード例 #1
0
ファイル: Player.cs プロジェクト: Chupaflor/Cronkpit_Samples
        public void cast_spell(Scroll s, Floor fl, gridCoordinate spell_target, int target_monster_ID, int target_Doodad_ID)
        {
            string spell_name = s.get_my_name();
            Projectile.projectile_type prj_type = s.get_assoc_projectile();
            Attack.Damage spell_dmg_type = s.get_damage_type();
            gridCoordinate starting_coord = my_grid_coord;
            Projectile.special_anim spec_prj_anim = s.get_spec_impact_anim();

            c_energy -= s.get_manaCost();
            max_energy += s.get_en_cap_adj();

            if (max_energy > 100)
                max_energy = 100;
            if (max_energy < 0)
                max_energy = 0;

            if (s.get_spell_type() == Scroll.Atk_Area_Type.piercingBolt)
            {
                int spell_range = s.get_range();
                int relative_x = (spell_target.x - my_grid_coord.x) * spell_range;
                int relative_y = (spell_target.y - my_grid_coord.y) * spell_range;
                starting_coord = new gridCoordinate(spell_target);
                spell_target = new gridCoordinate(my_grid_coord.x + relative_x, my_grid_coord.y + relative_y);
            }

            if (s.get_spell_type() != Scroll.Atk_Area_Type.personalBuff)
            {
                Projectile prj = new Projectile(starting_coord, spell_target, prj_type,
                                                 ref cont, false, s.get_spell_type());
                prj.attach_scroll(s);
                prj.set_wall_destroying(s.spell_destroys_walls());
                prj.set_special_anim(spec_prj_anim);

                if (s.get_spell_type() == Scroll.Atk_Area_Type.enemyDebuff)
                {
                    prj.attach_status_effect(s.get_status_effect(), s.get_duration(), s.does_spell_buff_count_down(), s.get_cost_per_turn(), s.get_cost_per_turn_per_turn());
                }

                if (s.get_spell_type() == Scroll.Atk_Area_Type.cloudAOE ||
                    s.get_spell_type() == Scroll.Atk_Area_Type.solidblockAOE ||
                    s.get_spell_type() == Scroll.Atk_Area_Type.randomblockAOE)
                    prj.set_AOE_size(s.get_aoe_size());

                if (s.get_spell_type() == Scroll.Atk_Area_Type.chainedBolt)
                {
                    prj.set_bounce(s.get_range());
                    prj.set_bounces_left(s.get_t_impacts());
                }

                if (String.Compare(s.get_my_name(), "Earthquake") == 0)
                    prj.set_special_anim(Projectile.special_anim.Earthquake);

                prj.set_talisman_effects(s.get_my_equipped_talismans());
                fl.create_new_projectile(prj);
            }
            else
            {
                int base_buff_time = s.get_duration();
                int modified_buff_time = base_buff_time;
                if (my_character == Character.Petaer)
                {
                    double buff_time_bonus = (double)modified_buff_time * .3;
                    modified_buff_time = (int)Math.Ceiling((double)modified_buff_time + buff_time_bonus);
                }
                add_single_statusEffect(new StatusEffect(s.get_status_effect(), modified_buff_time+1, s.does_spell_buff_count_down(), s.get_cost_per_turn(), s.get_cost_per_turn_per_turn(), false));
            }
        }