📄 items.cpp
字号:
/* BladeMaster 2, a text, rougelike(kinda), arena combat simulation game. Copyright (C) 2002 Blademaster 2 Team, see CREDITS Clone of BladeMaster by Logicom, Inc. Copyright(C) 1990/1993 In no means affliated with the original Blademaster or the original Blademaster creators/programmers. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Useful contact information: Website: blademaster2.sourceforge.net Project page: www.sf.net/projects/blademaster2/ Project Lead (see CREDITS for other members of the developement team) E-Mail: ilswyn@users.sourceforge.net AIM: ilswyn*/#include <ncurses.h>// #include <string.h> doesnt seem to work in a UNIX environment but string does#include <string> // for strlen() -Sairax#include "textgfx.h"#include "arena.h"#include "items.h"#include "players.h"#include "shops.h"#include "globals.h"// Deals damage to the player and then returns the amount// of damage dealt.int Weapon::do_attack(ArenaObject* obj){ ArenaObject* nearest_comp; nearest_comp = main_arena->get_nearest_type(arena_obj_list[0]->getObjPos(), COMP); // int damage = getrandom(getMinDmg(), getMaxDmg()); <- This cores BladeMaster int damage = getrandom(min_damage, max_damage); // obj->current_health -= damage; obj->setCurrentHealth(obj->getCurrentHealth() - damage); wattron(charsheet, COLOR_PAIR(3)); wattron(charsheet, A_BOLD); wattron(estats, COLOR_PAIR(1)); wattron(estats, A_BOLD); mvwprintw(charsheet, 5, 16, "%d ", ((HumanPlayer*)(arena_obj_list[0]))->getHealth()); mvwprintw(estats, 5, 16, "%d ", ((CompPlayer*)(nearest_comp))->getHealth()); wrefresh(charsheet); wattroff(estats, COLOR_PAIR(1)); wattroff(estats, A_BOLD); wattroff(charsheet, A_BOLD); wattroff(charsheet, COLOR_PAIR(3)); return damage;}Armor::Armor(){ armor_name = "leather";}Armor::~Armor() {}// No need for this now that we use string/*void Armor::setArmorName(string data){ armor_name = new char [strlen(data)+1]; strcpy(armor_name,data);}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -