Esempio n. 1
0
int main(object me, string arg)
{
  object ob, *inv;
  int i, count;
  if( !arg ) return notify_fail("你要装备什么武器?\n");
        arg = lower_case(arg);

  if(arg=="all") {
    inv = all_inventory(me);
    for(count=0, i=0; i<sizeof(inv); i++) {
      if( inv[i]->query("equipped") ) continue;
      if( inv[i]->query("id") == "fried chicken leg" && 
	  me->query("family") ) continue;
      if( do_wield(me, inv[i]) ) count ++;
    }
    write("Ok.\n");
    return 1;
  }

  if( !objectp(ob = present(arg, me)) )
    return notify_fail("你身上没有这样东西。\n");

  if( ob->query("equipped") )
    return notify_fail("你已经装备着了。\n");

  if( ob->query("id") == "fried chicken leg" && 
      me->query("family") )
    return notify_fail("你无法装备这样东西。\n");

  return do_wield(me, ob);
}
Esempio n. 2
0
int main(object me, string arg)
{
	object ob, *inv;
	int i, count;

	if( !arg ) return notify_fail("你要装备什么武器?\n");

	if(this_player()->query_temp("weapon"))
		return notify_fail("你已经装备武器了。\n");

	if(arg=="all")
	{
		inv = all_inventory(me);
		for(count=0, i=0; i<sizeof(inv); i++) {
			if( inv[i]->query("equipped") ) continue;
			if(this_player()->query_temp("weapon")) break;
			if(do_wield(me, inv[i]) ) count ++;
		}
		write("好了。\n");
		return 1;
	}

	if( !objectp(ob = present(arg, me)) )
		return notify_fail("你身上没有这样东西。\n");

	if( ob->query("equipped") )
		return notify_fail("你已经装备着了。\n");

	return do_wield(me, ob);
}
Esempio n. 3
0
void setup() {
   object obj;

   set_name("shayman");
   set_gender( "female" );
   add_adj("orc");
   add_ids("orc", "orc shayman");
   set_short("Orc shayman");
   set_long("An ugly orc shayman.  This thing looks wilder than your average " +
      "orc.");
   set_race("orc");
   set_level(10);
   set_aggressive(1);

   set_spell_chance(20);
   set_spell_damage(20);
   set_spell_message("The shayman casts a magic missile at $t.");

   set_hit_skill("combat/unarmed");
   set_skill("combat/unarmed", 50);
   set_skill("combat/defense", 100);

   obj = clone_object(DIR + "/obj/gold_staff.c");
   obj->setup();
   obj->move(this_object());
   obj = clone_object(DIR + "/obj/orc_slayer.c");
   obj->setup();
   obj->move(this_object());
   do_wield(obj);
}
Esempio n. 4
0
void
read_pack(object *pack, FILE *fp, boolean is_rogue)
{
    object read_obj, *new_obj;

    for (;;) {
	r_read(fp, (char *) &read_obj, sizeof(object));
	if (read_obj.ichar == 0) {
	    pack->next_object = (object *) 0;
	    break;
	}
	new_obj = alloc_object();
	*new_obj = read_obj;
	if (is_rogue) {
	    if (new_obj->in_use_flags & BEING_WORN) {
		do_wear(new_obj);
	    } else if (new_obj->in_use_flags & BEING_WIELDED) {
		do_wield(new_obj);
	    } else if (new_obj->in_use_flags & (ON_EITHER_HAND)) {
		do_put_on(new_obj, ((new_obj->in_use_flags & ON_LEFT_HAND)
				    ? 1 : 0));
	    }
	}
	pack->next_object = new_obj;
	pack = new_obj;
    }
}
Esempio n. 5
0
void set_wielding( mixed obj ) {
    object weapon;

    if( !obj )
        return;

    if( typeof(obj) == T_STRING ) {
        /* We've got to compile our own copy */
        weapon = clone_object( obj );
        if( weapon ) {
            weapon->setup();
            weapon->move( this_object() );
            do_wield( weapon );
        }
    } else {
        obj->move( this_object() );
        do_wield( obj );
    }
}
Esempio n. 6
0
void setup() {
   object obj;

   set_name("giant");
   set_gender( "male" );
   add_adj("fire");
   set_short("A fire giant");
   set_long("A mighty hot big guy.");
   set_race("giant");
   set_level(15);
   set_aggressive(1);
   set_hit_skill("combat/unarmed");
   set_skill("combat/unarmed", 50);
   set_skill("combat/defense", 100);

   obj = clone_object(DIR + "/obj/fire_sword");
   obj->setup();
   obj->move(this_object());
   do_wield(obj);
}
Esempio n. 7
0
void setup() {
   object obj;

   set_name("guard");
   set_gender( "female" );
   set_short("A guard");
   set_long("A big and sturdy guard.");
   set_race("human");
   set_level(11);
   set_hit_skill("combat/unarmed");
   set_skill("combat/unarmed", 50);
   set_skill("combat/defense", 100);

   obj = clone_object(DIR + "/obj/bankkey.c");
   obj->setup();
   obj->move(this_object());
   obj = clone_object("/domains/required/objects/short_sword.c");
   obj->setup();
   obj->move(this_object());
   do_wield(obj);
}
Esempio n. 8
0
void Engine::main_loop() {
    setup_curses();

    map->update_visibility_from(player->get_pos());
    render();

    main_loop_done = false;
    while(!main_loop_done) {

        switch (state) {
            case NEUTRAL:
                if (detect_player_and_mob_turns())
                    break;

                if (detect_modal_messages())
                    break;

                tick();

                break;
            case PLAYER_TURN:
                render();
                if(handle_keypress(getch())) {
                    state = NEUTRAL;
                    player->turn_taken();
                }
                map->update_visibility_from(player->get_pos());
                break;

            case MOB_TURN:
                do_ai();
                state = NEUTRAL;
                break;

            case VIEW_INVENTORY:
                render();
                render_inv();
                doupdate();
                getch();
                state = NEUTRAL;
                break;
            case WIELD:
                do_wield();
                state = NEUTRAL;
                player->turn_taken();
                break;
            case FIRE:
                if (fire_weapon()) {
                    player->turn_taken();
                }
                state = NEUTRAL;
                break;
            case MODAL_MSG:
                render();
                render_modal_messages();
                doupdate();
                while(getch() != ' ') {}
                state = NEUTRAL;
                break;

        }

        if (player->is_dead()) {
            game_over_lost();
        }


    }

    teardown_curses();
}