… | |
… | |
1593 | * hit_player_attacktype only figures out the damage, doesn't inflict |
1593 | * hit_player_attacktype only figures out the damage, doesn't inflict |
1594 | * it. It will do the appropriate action for attacktypes with |
1594 | * it. It will do the appropriate action for attacktypes with |
1595 | * effects (slow, paralization, etc. |
1595 | * effects (slow, paralization, etc. |
1596 | */ |
1596 | */ |
1597 | ndam = hit_player_attacktype (op, hitter, dam, attacknum, magic); |
1597 | ndam = hit_player_attacktype (op, hitter, dam, attacknum, magic); |
|
|
1598 | |
1598 | /* the >= causes us to prefer messages from special attacks, if |
1599 | /* the >= causes us to prefer messages from special attacks, if |
1599 | * the damage is equal. |
1600 | * the damage is equal. |
1600 | */ |
1601 | */ |
1601 | if (ndam >= maxdam) |
1602 | if (ndam >= maxdam) |
1602 | { |
1603 | { |
… | |
… | |
1665 | maxdam = maxdam / 2; |
1666 | maxdam = maxdam / 2; |
1666 | |
1667 | |
1667 | attack_message (maxdam, maxattacktype, op, hitter); |
1668 | attack_message (maxdam, maxattacktype, op, hitter); |
1668 | |
1669 | |
1669 | op->stats.hp -= maxdam; |
1670 | op->stats.hp -= maxdam; |
|
|
1671 | max_it (op->stats.hp, 0);//D |
1670 | |
1672 | |
1671 | /* Eneq(@csd.uu.se): Check to see if monster runs away. */ |
1673 | /* Eneq(@csd.uu.se): Check to see if monster runs away. */ |
1672 | if (op->stats.hp >= 0 |
1674 | if (op->stats.hp >= 0 |
1673 | && (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) |
1675 | && (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) |
1674 | && op->stats.hp < op->run_away * op->stats.maxhp / 100) |
1676 | && op->stats.hp * 100 < op->stats.maxhp * op->run_away) |
1675 | { |
1677 | { |
1676 | |
1678 | |
1677 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
1679 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
1678 | SET_FLAG (op, FLAG_RUN_AWAY); |
1680 | SET_FLAG (op, FLAG_RUN_AWAY); |
1679 | else |
1681 | else |
… | |
… | |
1700 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1702 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1701 | hitter->drop_and_destroy (); |
1703 | hitter->drop_and_destroy (); |
1702 | /* Lets handle creatures that are splitting now */ |
1704 | /* Lets handle creatures that are splitting now */ |
1703 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1705 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1704 | { |
1706 | { |
1705 | int i; |
|
|
1706 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
1707 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
1707 | int unaggressive = QUERY_FLAG (op, FLAG_UNAGGRESSIVE); |
1708 | int unaggressive = QUERY_FLAG (op, FLAG_UNAGGRESSIVE); |
1708 | object *owner = op->owner; |
1709 | object *owner = op->owner; |
1709 | |
1710 | |
1710 | if (!op->other_arch) |
1711 | if (!op->other_arch) |
… | |
… | |
1713 | return maxdam; |
1714 | return maxdam; |
1714 | } |
1715 | } |
1715 | |
1716 | |
1716 | op->remove (); |
1717 | op->remove (); |
1717 | |
1718 | |
1718 | for (i = 0; i < op->stats.food; i++) |
1719 | for (int i = 0; i < op->stats.food; i++) |
1719 | { /* This doesn't handle op->more yet */ |
1720 | { /* This doesn't handle op->more yet */ |
1720 | object *tmp = arch_to_object (op->other_arch); |
1721 | object *tmp = arch_to_object (op->other_arch); |
1721 | int j; |
|
|
1722 | |
1722 | |
1723 | tmp->stats.hp = op->stats.hp; |
1723 | tmp->stats.hp = op->stats.hp; |
1724 | |
1724 | |
1725 | if (friendly) |
1725 | if (friendly) |
1726 | { |
1726 | { |
… | |
… | |
1732 | } |
1732 | } |
1733 | |
1733 | |
1734 | if (unaggressive) |
1734 | if (unaggressive) |
1735 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
1735 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
1736 | |
1736 | |
1737 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
1737 | int j = find_first_free_spot (tmp, op->map, op->x, op->y); |
1738 | |
1738 | |
1739 | if (j == -1) /* No spot to put this monster */ |
1739 | if (j == -1) /* No spot to put this monster */ |
1740 | tmp->destroy (); |
1740 | tmp->destroy (); |
1741 | else |
1741 | else |
1742 | { |
1742 | { |