Emit Magic X14393


Statement
 

pdf   zip

html

There are a number of locations that are part of an adventure game. At each location there is a given set of characters and a given set of items. Your task is to simulate several actions in the adventure game.

Input

The input starts with an integer N denoting the number of locations. The next N lines contain the name of the locations.

The next line contains an integer M denoting the number of characters. The next M lines contain the description of each character on the format “<character type>-<character name>-<character level> <location name>”. Valid character types are “Cure”, “Damage” and “Character”.

The next line contains an integer K denoting the number of items. The next K lines contain the description of each character on the format “<item type>-<item name>-<item level> <location name>”. Valid item types are “Bomb”, “Potion”, “Trap” and “Item”.

The next line contains an integer A denoting the number of actions. The next A lines contains the description of each action, which can be either “Use” or “Distribute”. The format for each type of action is
“Use-<character name>-<item name>-<location name>”
“Distribute-<location name>-<magic amount>”

Output

For each location in the order they appear in the input, print the result of applying each action in the adventure game, on the format specified in the example.

Public test cases
  • Input

    1
    Paradise
    2
    Cure-Eve-0 Paradise
    Damage-Adam-1 Paradise
    3
    Bomb-Bomb-0 Paradise
    Trap-Trap-0 Paradise
    Item-Apple-0 Paradise
    3
    Use-Eve-Trap-Paradise
    Distribute-Paradise-0
    Use-Eve-Bomb-Paradise
    

    Output

    Eve uses Trap at Paradise
    Eve takes 5 damage
    Eve receives 0 magic points
    Eve gains 0 life
    Adam receives 0 magic points
    Adam takes 0 damage
    Bomb receives 0 magic points
    Apple receives 0 magic points
    Eve uses Bomb at Paradise
    Bomb explodes
    Eve receives 5 magic points
    Eve gains 5 life
    Adam receives 5 magic points
    Adam takes 5 damage
    Apple receives 5 magic points
    
  • Information
    Author
    Anders Jonsson
    Language
    English
    Official solutions
    C++
    User solutions
    C++