123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- #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;
- }
|