| 758 | } |
| 759 | |
| 760 | void Entity::effectTimes() |
| 761 | { |
| 762 | Stat* myStats = this->getStats(); |
| 763 | int player; |
| 764 | spell_t* spell = NULL; |
| 765 | node_t* node = NULL; |
| 766 | int count = 0; |
| 767 | |
| 768 | if ( myStats == NULL ) |
| 769 | { |
| 770 | return; |
| 771 | } |
| 772 | if ( this->behavior == &actPlayer ) |
| 773 | { |
| 774 | player = this->skill[2]; |
| 775 | } |
| 776 | else |
| 777 | { |
| 778 | player = -1; |
| 779 | } |
| 780 | |
| 781 | spell_t* invisibility_hijacked = nullptr; //If NULL, function proceeds as normal. If points to something, it ignores the invisibility timer since a spell is doing things. //TODO: Incorporate the spell into isInvisible() instead? |
| 782 | spell_t* levitation_hijacked = nullptr; //If NULL, function proceeds as normal. If points to something, it ignore the levitation timer since a spell is doing things. |
| 783 | spell_t* reflectMagic_hijacked = nullptr; |
| 784 | spell_t* amplifyMagic_hijacked = nullptr; |
| 785 | spell_t* vampiricAura_hijacked = nullptr; |
| 786 | std::map<int, spell_t*> sustainedSpell_hijacked; |
| 787 | //Handle magic effects (like invisibility) |
| 788 | for ( node = myStats->magic_effects.first; node; node = node->next, ++count ) |
| 789 | { |
| 790 | //printlog( "%s\n", "Potato."); |
| 791 | //Handle magic effects. |
| 792 | spell = (spell_t*)node->element; |
| 793 | if ( !spell->sustain ) |
| 794 | { |
| 795 | node_t* temp = NULL; |
| 796 | if ( node->prev ) |
| 797 | { |
| 798 | temp = node->prev; |
| 799 | } |
| 800 | else if ( node->next ) |
| 801 | { |
| 802 | temp = node->next; |
| 803 | } |
| 804 | spell->magic_effects_node = NULL; //To prevent recursive removal, which results in a crash. |
| 805 | if ( player > 0 && multiplayer == SERVER && !players[player]->isLocalPlayer() ) |
| 806 | { |
| 807 | strcpy((char*)net_packet->data, "UNCH"); |
| 808 | net_packet->data[4] = player; |
| 809 | SDLNet_Write32(spell->ID, &net_packet->data[5]); |
| 810 | net_packet->address.host = net_clients[player - 1].host; |
| 811 | net_packet->address.port = net_clients[player - 1].port; |
| 812 | net_packet->len = 9; |
| 813 | sendPacketSafe(net_sock, -1, net_packet, player - 1); |
| 814 | } |
| 815 | if ( spell->sustainEffectDissipate >= 0 ) |
| 816 | { |
| 817 | if ( myStats->getEffectActive(spell->sustainEffectDissipate) ) |
no test coverage detected