#include "Gegenstand.h" Resource *zResourceOfItem( GegenstandTyp typ, ResourceRegistry *zResources ) { switch( typ ) { case PFEIL: return zResources->zResource( R_PFEIL, 0 ); case LEBEN: return zResources->zResource( R_LEBEN, 0 ); case SCHILD: return zResources->zResource( R_SCHILD, 0 ); case SCHUH: return zResources->zResource( R_SCHUH, 0 ); case GEIST: return zResources->zResource( R_GEIST, 0 ); case KUGEL: return zResources->zResource( R_KUGEL, 0 ); case ROLLE: return zResources->zResource( R_ROLLE, 0 ); case STURM: return zResources->zResource( R_STURM, 0 ); case DRACHENAUGE: return zResources->zResource( R_DRACHENAUGE, 0 ); case FEUERBALL: return zResources->zResource( R_FEUERBALL, 0 ); case ENTERHAKEN: return zResources->zResource( R_ENTERHAKEN_ITEM, 0 ); case MINE: return zResources->zResource( R_MINE, 0 ); case RWEISHEIT: return zResources->zResource( R_RWEISHEIT, 0 ); case RSTRENGTH: return zResources->zResource( R_RSTRENGTH, 0 ); case RBOSHEIT: return zResources->zResource( R_RBOSHEIT, 0 ); case RLEBEN: return zResources->zResource( R_RLEBEN, 0 ); case RTEMPO: return zResources->zResource( R_RTEMPO, 0 ); default: break; } return 0; } 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( ResourceRegistry *zResources, 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; texturScale = 1; switch( typ ) { case PFEIL: this->textur = zResources->zResource( R_PFEIL, 0 )->getImages()->getThis(); break; case LEBEN: this->textur = zResources->zResource( R_LEBEN, 0 )->getImages()->getThis(); break; case SCHILD: this->textur = zResources->zResource( R_SCHILD, 0 )->getImages()->getThis(); break; case SCHUH: this->textur = zResources->zResource( R_SCHUH, 0 )->getImages()->getThis(); break; case GEIST: this->textur = zResources->zResource( R_GEIST, 0 )->getImages()->getThis(); break; case KUGEL: this->textur = zResources->zResource( R_KUGEL, 0 )->getImages()->getThis(); break; case ROLLE: this->textur = zResources->zResource( R_ROLLE, 0 )->getImages()->getThis(); break; case STURM: this->textur = zResources->zResource( R_STURM, 0 )->getImages()->getThis(); break; case DRACHENAUGE: this->textur = zResources->zResource( R_DRACHENAUGE, 0 )->getImages()->getThis(); break; case FEUERBALL: this->textur = zResources->zResource( R_FEUERBALL, 0 )->getImages()->getThis(); break; case ENTERHAKEN: this->textur = zResources->zResource( R_ENTERHAKEN_ITEM, 0 )->getImages()->getThis(); break; case MINE: this->textur = zResources->zResource( R_MINE, 0 )->getImages()->getThis(); break; case RWEISHEIT: this->textur = zResources->zResource( R_RWEISHEIT, 0 )->getImages()->getThis(); break; case RSTRENGTH: this->textur = zResources->zResource( R_RSTRENGTH, 0 )->getImages()->getThis(); break; case RBOSHEIT: this->textur = zResources->zResource( R_RBOSHEIT, 0 )->getImages()->getThis(); break; case RLEBEN: this->textur = zResources->zResource( R_RLEBEN, 0 )->getImages()->getThis(); break; case RTEMPO: this->textur = zResources->zResource( R_RTEMPO, 0 )->getImages()->getThis(); break; default: break; } } int Gegenstand::getId() const { return id; } bool Gegenstand::tick( double zeit ) { timeLeft -= zeit; return timeLeft <= 0; } GegenstandTyp Gegenstand::getTyp() const { return typ; }