#include "Gegenstand.h" bool consumable( GegenstandTyp typ ) { switch( typ ) { case PFEIL: return 1; case LEBEN: return 1; case SCHILD: return 0; case SCHUH: return 0; case GEIST: return 0; case KUGEL: return 1; case ROLLE: return 0; case STURM: return 0; case DRACHENAUGE: return 1; case FEUERBALL: return 1; case ENTERHAKEN: return 0; case MINE: return 1; case RWEISHEIT: case RSTRENGTH: case RBOSHEIT: case RLEBEN: case RTEMPO: default: return 0; } } float abklingzeit( GegenstandTyp typ ) { switch( typ ) { case PFEIL: return 5; case LEBEN: return 5; case SCHILD: return 100; case SCHUH: return 100; case GEIST: return 100; case KUGEL: return 5; case ROLLE: return 30; case STURM: return 30; case DRACHENAUGE: return 5; case FEUERBALL: return 5; case ENTERHAKEN: return 60; case MINE: return 5; case RWEISHEIT: case RSTRENGTH: case RBOSHEIT: case RLEBEN: case RTEMPO: default: return 0; } } bool storable( GegenstandTyp typ ) { return !(typ == RWEISHEIT || typ == RSTRENGTH || typ == RBOSHEIT || typ == RLEBEN || typ == RTEMPO); } bool brauchtRichtung( GegenstandTyp typ ) { return typ == PFEIL || typ == KUGEL || typ == DRACHENAUGE || typ == FEUERBALL || typ == ENTERHAKEN || typ == ROLLE || typ == STURM; } GegenstandTypVar::GegenstandTypVar( GegenstandTyp value ) : Variable( GEGENSTAND_TYP ) { this->value = value; } void GegenstandTypVar::setValue( GegenstandTyp value ) { this->value = value; } GegenstandTyp GegenstandTypVar::getValue() const { return value; } Gegenstand::Gegenstand( int id, GegenstandTyp typ, int x, int y, int w, int h ) : GameObject( GEGENSTAND, x, y, w, h ) { timeLeft = 120; this->id = id; this->typ = typ; } int Gegenstand::getId() const { return id; } bool Gegenstand::tick( double zeit ) { timeLeft -= zeit; return timeLeft <= 0; } GegenstandTyp Gegenstand::getTyp() const { return typ; }