#include <iostream>

#include <string>

#include <vector>


class Option {

protected:

std::string opt_name;

public:

Option(std::string name)

{

opt_name = name;

}

virtual void print_opt() const = 0;

virtual int calc_damage() = 0;

};


class Attribute : public Option {

private:

int add_damage;

public:

Attribute(std::string name, int add_dmg) : Option(name)

{

add_damage = add_dmg;

}

virtual void print_opt() const

{

// 무기 속성(불,물..등) 디스플레이.. 알아서..

}

virtual int calc_damage()

{

// 속성 무기 데미지 계산

return add_damage;

}

};


class Splash : public Option {

private:

int add_damage;

int splash_range;

int splash_prob;

public:

Splash(std::string name, int add_dmg, int sph_range, int prob) : Option(name)

{

add_damage = add_dmg;

splash_range = sph_range;

splash_prob = prob;

}

void print_opt() const

{

// 무기 스플래쉬 알아서 출력..

}

virtual int calc_damage()

{

// 스플레시 무기 데미지 계산..

return add_damage;

}

};


class Critical : public Option {

private:

int critical_prob;

float critical_pow;

public:

Critical(std::string name, int prob, float pow) : Option(name)

{

critical_prob = prob;

critical_pow = pow;

}

void print_opt() const

{

// 무기 치명타 정보 알아서 출력..

}

virtual int calc_damage()

{

// 치명타 무기 데미지 계산

return 0;

}

};


class Weapon {

protected:

std::string name;

int damage;

int level;

int stamina;

std::vector<Option*> opt_ary;

public:

Weapon(std::string _name, int dmg, int lvl, int stm)

{

name = _name;

damage = dmg;

level = lvl;

stamina = stm;

opt_ary.clear();

}

virtual ~Weapon() { }

void use_weapon()

{

/* 해당 무기의 모든 옵션에 대해 데미지 계산 총체적으로 */

for (std::vector<Option*>::iterator iter = opt_ary.begin();

iter != opt_ary.end(); iter++)

{

(*iter)->calc_damage();

// 기타 사용 옵션은 알아서..

}

}

void add_option(Option* opt)

{

opt_ary.push_back(opt);

}

};


class Melee : public Weapon {

private:

int stun_prob; // 스턴확률

public:

Melee(std::string name, int dmg, int lvl, int stm, int prob) : Weapon(name, dmg, lvl, stm)

{

stun_prob = prob;

}

~Melee()

{

for (std::vector<Option*>::iterator iter = opt_ary.begin();

iter != opt_ary.end(); iter++)

{

delete (*iter);

}

}

};


class Range : public Weapon {

private:

int range_dist; // 사정거리

public:

Range(std::string name, int dmg, int lvl, int stm, int dist) : Weapon(name, dmg, lvl, stm)

{

range_dist;

}

~Range()

{

for (std::vector<Option*>::iterator iter = opt_ary.begin();

iter != opt_ary.end(); iter++)

{

delete (*iter);

}

}

};


class WeaponCreator {

private:

enum { FIRE = 0, WATER, EARTH, WIND };

int attribute_damage[4];

public:

WeaponCreator()

{

attribute_damage[FIRE] = 100;

attribute_damage[WATER] = 200;

attribute_damage[EARTH] = 300;

attribute_damage[WIND] = 400;

}

void create()

{

/* 근거리 무기인 검을 데미지 100, 레벨제한 70, 내구도 100, 스턴확률 30으로 만듬ㅋ */

Weapon* w1 = new Melee("검", 100, 70, 100, 30);

w1->add_option(new Attribute("불속성", attribute_damage[FIRE])); // 불속성 데미지 100짜리 옵션 부여

w1->add_option(new Splash("스플레시", 20, 300, 50)); // 데미지 100, 범위 300, 확률 50짜리 스플래시 옵션 부여

w1->add_option(new Critical("치명타", 20, 1.5)); // 확률 20, 데미지 1.5배 치명타 옵션 부여 ㅋ

}

};


int main(void)

{

WeaponCreator crt;


crt.create();

}


대략적인 구조는 weapon을 근거리무기클래스랑 원거리무기클래스에서 상속받고
각 무기마다 옵션리스트를 갖고있음. 그럼 다중상속도 일어날필요없고 옵션 마음대러 추가 가능.
급하게 만들어서 나머지 니가 알아서 구현하셈