コード例 #1
0
ファイル: Monster.cs プロジェクト: SnarkhProject/Cronkpit
        public bool can_hear_sound(SoundPulse.Sound_Types soundID, int soundStrength)
        {
            for (int i = 0; i < sounds_i_can_hear.Count; i++)
            {
                if (sounds_i_can_hear[i] == soundID && soundStrength > listen_threshold[i])
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
ファイル: Monster.cs プロジェクト: SnarkhProject/Cronkpit
 //Get a new path to the sound
 public void next_path_to_sound(List <gridCoordinate> path, SoundPulse.Sound_Types soundID)
 {
     if (!heard_something)
     {
         if (sound_has_priority(soundID))
         {
             shortest_path_to_sound = new List <gridCoordinate>(path);
             heard_something        = true;
             last_sound_i_heard     = soundID;
         }
     }
     else if (heard_something && path.Count < shortest_path_to_sound.Count)
     {
         shortest_path_to_sound = new List <gridCoordinate>(path);
     }
 }
コード例 #3
0
ファイル: Monster.cs プロジェクト: SnarkhProject/Cronkpit
        private bool sound_has_priority(SoundPulse.Sound_Types soundID)
        {
            int current_sound_priority = sounds_i_can_hear.Count + 1;
            int soundID_priority       = 0;

            for (int i = 0; i < sounds_i_can_hear.Count; i++)
            {
                if (sounds_i_can_hear[i] == last_sound_i_heard)
                {
                    current_sound_priority = i;
                }
                if (sounds_i_can_hear[i] == soundID)
                {
                    soundID_priority = i;
                }
            }

            return(soundID_priority <= current_sound_priority);
        }
コード例 #4
0
ファイル: Monster.cs プロジェクト: SnarkhProject/Cronkpit
        //Follow the path to the sound
        public void follow_path_to_sound(Floor fl, Player pl)
        {
            //Get rid of the coordinate that we're standing on.
            if (heard_something)
            {
                last_path_to_sound = new List <gridCoordinate>(shortest_path_to_sound);
                shortest_path_to_sound.Clear();
                heard_something    = false;
                last_sound_i_heard = SoundPulse.Sound_Types.None;
            }
            int path_length = last_path_to_sound.Count - 1;

            if (path_length >= 0 && !rooted)
            {
                advance_towards_single_point(last_path_to_sound[path_length], pl, fl, 0, corporeal);
                if (occupies_tile(last_path_to_sound[path_length]))
                {
                    last_path_to_sound.RemoveAt(path_length);
                }
            }
        }
コード例 #5
0
ファイル: Monster.cs プロジェクト: SnarkhProject/Cronkpit
        public Monster(gridCoordinate sGridCoord, ContentManager sCont, int sIndex, Monster_Size monSize)
        {
            my_grid_coords = new List <gridCoordinate>();
            cont           = sCont;
            switch (monSize)
            {
            case Monster_Size.Normal:
                my_grid_coords.Add(new gridCoordinate(sGridCoord));
                my_monster_size = Monster_Size.Normal;
                break;

            case Monster_Size.Large:
                my_grid_coords.Add(new gridCoordinate(sGridCoord));
                my_grid_coords.Add(new gridCoordinate(sGridCoord.x + 1, sGridCoord.y));
                my_grid_coords.Add(new gridCoordinate(sGridCoord.x, sGridCoord.y + 1));
                my_grid_coords.Add(new gridCoordinate(sGridCoord.x + 1, sGridCoord.y + 1));
                my_monster_size = Monster_Size.Large;
                break;

            default:
                my_grid_coords.Add(new gridCoordinate(sGridCoord));
                break;
            }

            strongest_smell_coord = new gridCoordinate(sGridCoord);
            my_Position           = new Vector2(sGridCoord.x * 32, sGridCoord.y * 32);
            rGen     = new Random();
            my_Index = sIndex;

            // FOR DEBUGGING PURPOSES - PERFECTLY SAFE TO UNCOMMENT
            //sound_stuff = sCont.Load<Texture2D>("sound shit");

            //Sensory stuff
            //Sight
            base_sight_range = 0;
            sight_range      = 0;
            //Smell
            has_scent            = false;
            smell_range          = 0;
            base_smell_range     = 0;
            base_smell_threshold = 0;
            smell_threshold      = 0;
            //Sound
            can_hear               = false;
            heard_something        = false;
            shortest_path_to_sound = new List <gridCoordinate>();
            last_path_to_sound     = new List <gridCoordinate>();
            sounds_i_can_hear      = new List <SoundPulse.Sound_Types>();
            listen_threshold       = new List <int>();
            base_listen_threshold  = new List <int>();
            last_sound_i_heard     = SoundPulse.Sound_Types.None;

            //Damage stuff
            max_hitPoints        = 0;
            hitPoints            = 0;
            armorPoints          = 0;
            min_damage           = 0;
            max_damage           = 0;
            corporeal            = true;
            dodge_values_degrade = true;

            //status affliction stuff
            BuffDebuffTracker = new List <StatusEffect>();

            //other

            /*
             * Brief explanation of how this works. if you set the denominator to
             * any nonzero number and increment the numerator every turn it means that the monster
             * will take [denominator] actions every [denominator+1] turns. So for example setting it
             * to 2 would mean that the monster will take 2 actions every 3 turns.
             */
            active              = false;
            speed_numerator     = 0;
            speed_denominator   = 0;
            melee_dodge         = 0;
            ranged_dodge        = 0;
            armor_effectiveness = 0;
            my_name             = "";
            smart_monster       = false;
            boss_monster        = false;

            movement_indexes  = new List <int[]>();
            direction_indexes = new List <gridCoordinate.direction>();
            build_movement_and_direction_indexes();
        }