本文整理汇总了C#中Floor.Doodad_by_index方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.Doodad_by_index方法的具体用法?C# Floor.Doodad_by_index怎么用?C# Floor.Doodad_by_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor.Doodad_by_index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: charge_attack
public void charge_attack(Floor fl, Weapon lance, gridCoordinate charge_coordinate, int monsterID, int DoodadID)
{
bool attacked_Doodad = false;
bool rolled_max = false;
gridCoordinate my_original_position = new gridCoordinate(my_grid_coord);
Weapon c_lance = lance;
VisionRay attack_ray = null;
if(fl.badguy_by_monster_id(monsterID) == null)
{
attack_ray = new VisionRay(my_grid_coord, fl.Doodad_by_index(DoodadID).get_g_coord());
}
else
attack_ray = new VisionRay(my_grid_coord, charge_coordinate);
gridCoordinate monster_coord = new gridCoordinate(-1, -1);
gridCoordinate Doodad_coord = new gridCoordinate(-1, -1);
bool done = false;
while (!done)
{
int old_xPosition = (int)attack_ray.my_current_position.X / 32;
int old_yPosition = (int)attack_ray.my_current_position.Y / 32;
gridCoordinate previous_ray_position = new gridCoordinate(old_xPosition, old_yPosition);
attack_ray.update();
int new_xPosition = (int)attack_ray.my_current_position.X / 32;
int new_yPosition = (int)attack_ray.my_current_position.Y / 32;
gridCoordinate next_ray_position = new gridCoordinate(new_xPosition, new_yPosition);
int mon_ID;
int dood_ID;
fl.is_monster_here(next_ray_position, out mon_ID);
fl.is_destroyable_Doodad_here(next_ray_position, out dood_ID);
if (mon_ID == monsterID && monsterID > -1)
{
monster_coord = new gridCoordinate(charge_coordinate);
teleport(previous_ray_position);
attack_monster_in_grid(fl, lance, monsterID, charge_coordinate, 1.0, out rolled_max, true);
done = true;
}
if (dood_ID == DoodadID && DoodadID > -1)
{
attacked_Doodad = true;
Doodad_coord = new gridCoordinate(fl.Doodad_by_index(DoodadID).get_g_coord());
teleport(previous_ray_position);
attack_Doodad_in_grid(fl, lance, DoodadID, fl.Doodad_by_index(DoodadID).get_g_coord(), 1.0, out rolled_max, true);
done = true;
}
}
gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
if (attacked_Doodad)
opposition_coord = Doodad_coord;
else
opposition_coord = monster_coord;
if (!is_spot_free(fl, my_grid_coord))
{
int xdif = my_original_position.x - opposition_coord.x;
int ydif = my_original_position.y - opposition_coord.y;
int whocares = -1;
if (fl.is_monster_here(my_grid_coord, out whocares) || fl.is_destroyable_Doodad_here(my_grid_coord, out whocares))
{
if (xdif == 0)
if (my_original_position.x < my_grid_coord.x)
my_grid_coord.x--;
else
my_grid_coord.x++;
if (ydif == 0)
if (my_original_position.y < my_grid_coord.y)
my_grid_coord.y--;
else
my_grid_coord.y++;
}
else if (!fl.is_monster_here(my_grid_coord, out whocares) && !fl.isWalkable(my_grid_coord))
{
int xshift = 0;
int yshift = 0;
if (xdif < 0)
xshift = -1;
else
xshift = 1;
if (ydif < 0)
yshift = -1;
else
yshift = 1;
gridCoordinate x_shifted = new gridCoordinate(my_grid_coord.x + xshift, my_grid_coord.y);
gridCoordinate y_shifted = new gridCoordinate(my_grid_coord.x, my_grid_coord.y + yshift);
bool x_ok = fl.isWalkable(x_shifted);
bool y_ok = fl.isWalkable(y_shifted);
//.........这里部分代码省略.........
示例2: attack_Doodad_in_grid
public void attack_Doodad_in_grid(Floor fl, Weapon w, int c_DoodadID, gridCoordinate current_gc, double multiplier, out bool rolled_max, bool charge_attack = false)
{
rolled_max = false;
if (w != null)
{
string attack_msg = "You attack the " + fl.Doodad_by_index(c_DoodadID).my_name() + " with your " + w.get_my_name() + "!";
message_buffer.Add(attack_msg);
List<Attack> attacks = new List<Attack>();
List<StatusEffect> debuffs = new List<StatusEffect>();
handle_attack_damage(w, null, multiplier, charge_attack, out rolled_max, ref attacks, ref debuffs);
fl.damage_Doodad(attacks, c_DoodadID);
}
else
{
double base_dmg_val = (double)rGen.Next(1, 4) * multiplier;
if (base_dmg_val == 3 * multiplier)
rolled_max = true;
int modified_dmg_val = (int)base_dmg_val;
if (my_character == Character.Falsael)
modified_dmg_val = (int)Math.Ceiling(base_dmg_val * 1.2);
List<Attack> attacks = new List<Attack>();
attacks.Add(new Attack(Attack.Damage.Crushing, modified_dmg_val));
string attack_msg = "You attack the " + fl.Doodad_by_index(c_DoodadID).my_name() + " with your fists!";
message_buffer.Add(attack_msg);
fl.damage_Doodad(attacks, c_DoodadID);
}
}
示例3: bow_attack
public void bow_attack(Floor fl, ref ContentManager Secondary_cManager, gridCoordinate attack_location, int monsterID, int DoodadID)
{
Weapon Bow = null;
if (main_hand != null && (main_hand.get_my_weapon_type() == Weapon.Type.Bow ||
main_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
Bow = main_hand;
else if (off_hand != null && (off_hand.get_my_weapon_type() == Weapon.Type.Bow ||
off_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
Bow = off_hand;
gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
if (monsterID != -1)
opposition_coord = attack_location;
else
opposition_coord = fl.Doodad_by_index(DoodadID).get_g_coord();
int cbow_xsplash = 0;
int cbow_ysplash = 0;
if (opposition_coord.x < my_grid_coord.x)
cbow_xsplash = -1;
else if (opposition_coord.x > my_grid_coord.x)
cbow_xsplash = 1;
if (opposition_coord.y < my_grid_coord.y)
cbow_ysplash = -1;
else if (opposition_coord.y > my_grid_coord.y)
cbow_ysplash = 1;
gridCoordinate splash_coord = new gridCoordinate(opposition_coord.x + cbow_xsplash, opposition_coord.y + cbow_ysplash);
int base_min_dmg_to_monster = Bow.specific_damage_val(false);
int base_max_dmg_to_monster = Bow.specific_damage_val(true);
int max_dmg_to_monster = (int)base_max_dmg_to_monster;
int min_dmg_to_monster = (int)base_min_dmg_to_monster;
if (is_cbow_equipped() && my_character == Character.Falsael)
{
max_dmg_to_monster = (int)Math.Ceiling(base_max_dmg_to_monster * 1.2);
min_dmg_to_monster = (int)Math.Ceiling(base_min_dmg_to_monster * 1.2);
}
if (Bow.get_my_weapon_type() == Weapon.Type.Bow)
{
Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Arrow, ref Secondary_cManager, false, Scroll.Atk_Area_Type.singleTile);
prj.attach_weapon(Bow);
fl.create_new_projectile(prj);
}
else if(Bow.get_my_weapon_type() == Weapon.Type.Crossbow)
{
Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Crossbow_Bolt, ref Secondary_cManager, false, Scroll.Atk_Area_Type.smallfixedAOE);
List<gridCoordinate> crossbow_aoe = new List<gridCoordinate>();
crossbow_aoe.Add(opposition_coord);
crossbow_aoe.Add(splash_coord);
prj.set_small_AOE_matrix(crossbow_aoe);
prj.attach_weapon(Bow);
fl.create_new_projectile(prj);
}
string attack_msg = "";
if (monsterID != -1)
attack_msg = "You attack the " + fl.badguy_by_monster_id(monsterID).my_name + " with your " + Bow.get_my_name() + "!";
else
attack_msg = "You attack the " + fl.Doodad_by_index(DoodadID).my_name() + " with your " + Bow.get_my_name() + "!";
message_buffer.Add(attack_msg);
total_sound += my_sound_value() + (my_sound_value() / 2);
total_scent += my_scent_value();
if (my_class == Chara_Class.Warrior)
{
c_energy += 6;
}
}
示例4: move
public void move(gridCoordinate.direction dir, Floor fl)
{
int MonsterID = -1;
Doodad target_doodad = null;
bool opened_door = false;
gridCoordinate test_coord = new gridCoordinate(my_grid_coord);
test_coord.shift_direction(dir);
if (is_spot_free(fl, test_coord))
{
my_grid_coord = test_coord;
reset_my_drawing_position();
}
else
{
int DoodadID = -1;
//Check for monsters / doodads first.
fl.is_monster_here(test_coord, out MonsterID);
if (fl.is_impassible_doodad_here(test_coord, out DoodadID))
target_doodad = fl.Doodad_by_index(DoodadID);
//Check to see if there's a door there. If there is, attempt to open it.
fl.open_door_here(test_coord, out opened_door);
}
if (MonsterID != -1)
melee_attack(fl, my_grid_coord, test_coord);
if (target_doodad != null)
{
switch (target_doodad.get_my_doodad_type())
{
case Doodad.Doodad_Type.Door:
fl.open_door_here(test_coord, out opened_door);
if (!opened_door)
melee_attack(fl, my_grid_coord, test_coord);
break;
case Doodad.Doodad_Type.TreasureBox:
if (!target_doodad.is_chest_open())
target_doodad.open_chest(fl);
else
if (target_doodad.chest_contains_stuff())
target_doodad.loot_chest(fl, this);
break;
default:
melee_attack(fl, my_grid_coord, test_coord);
break;
}
}
//after moving, loot the current tile, and set sound / smell values.
loot(fl);
total_sound = my_sound_value();
total_scent = my_scent_value();
}